String Comparison Functions and Operators • \%  matches one  %  character. • \_  matches one  _  character. mysql>  SELECT ’David!’ LIKE ’David\_’; -> 0 mysql>  SELECT ’David_’ LIKE ’David\_’; -> 1 mysql>  SELECT ’David_’ LIKE ’David|_’ ESCAPE ’|’; -> 1 mysql>  SELECT ’abc’ LIKE ’ABC’; -> 1 mysql>  SELECT ’abc’ LIKE _utf8mb4 ’ABC’ COLLATE utf8mb4_0900_as_cs; -> 0 mysql>  SELECT ’abc’ LIKE _utf8mb4 ’ABC’ COLLATE utf8mb4_bin; -> 0 mysql>  SELECT ’abc’ LIKE BINARY ’ABC’; -> 0 mysql>  SELECT 10 LIKE ’1%’; -> 1 mysql>  SELECT filename FROM t1; +--------------+ | filename | +--------------+ | C: | | C:\ | | C:\Programs | | C:\Programs\ | MySQL uses C escape syntax in strings (for example,   to represent the newline character). If you want a  LIKE  string to contain a literal  \ , you must double it. (Unless the  NO_BACKSLASH_ESCAPES  SQL mode is enabled, in which case no escape character is used.) For example, to search for  , specify it as \
 . To search for  \ , specify it as  \\\\ ; this is because the backslashes are stripped once by the parser and again when the pattern match is made, leaving a single backslash to be matched against. Exception: At the end of the pattern string, backslash can be specified as  \\ . At the end of the string, backslash stands for itself because there is nothing following to escape. Suppose that a table contains the following values: As an extension to standard SQL, MySQL permits  LIKE  on numeric expressions. The following two statements illustrate that string comparisons are not case-sensitive unless one of the operands is case-sensitive (uses a case-sensitive collation or is a binary string): The escape sequence should be one character long to specify the escape character, or empty to specify that no escape character is used. The expression must evaluate as a constant at execution time. If the NO_BACKSLASH_ESCAPES  SQL mode is enabled, the sequence cannot be empty. To specify a different escape character, use the  ESCAPE  clause: Note 2188