String Comparison Functions and Operators Name Description NOT LIKE Negation of simple pattern matching STRCMP() Compare two strings If a string function is given a binary string as an argument, the resulting string is also a binary string. A number converted to a string is treated as a binary string. This affects only comparisons. Normally, if any expression in a string comparison is case-sensitive, the comparison is performed in case- sensitive fashion. If a string function is invoked from within the  mysql  client, binary strings display using hexadecimal notation, depending on the value of the  --binary-as-hex . For more information about that option, see Section 4.5.1, “mysql — The MySQL Command-Line Client” . • expr  LIKE  pat  [ESCAPE ’ escape_char ’] Pattern matching using an SQL pattern. Returns  1  ( TRUE ) or  0  ( FALSE ). If either  expr  or  pat  is  NULL , the result is  NULL . The pattern need not be a literal string. For example, it can be specified as a string expression or table column. In the latter case, the column must be defined as one of the MySQL string types (see Section 11.3, “String Data Types” ). Per the SQL standard,  LIKE  performs matching on a per-character basis, thus it can produce results different from the  =  comparison operator: mysql>  SELECT ’ä’ LIKE ’ae’ COLLATE latin1_german2_ci; +-----------------------------------------+ | ’ä’ LIKE ’ae’ COLLATE latin1_german2_ci | +-----------------------------------------+ | 0 | +-----------------------------------------+ mysql>  SELECT ’ä’ = ’ae’ COLLATE latin1_german2_ci; +--------------------------------------+ | ’ä’ = ’ae’ COLLATE latin1_german2_ci | +--------------------------------------+ | 1 | +--------------------------------------+ In particular, trailing spaces are always significant. This differs from comparisons performed with the  = operator, for which the significance of trailing spaces in nonbinary strings ( CHAR ,  VARCHAR , and  TEXT values) depends on the pad attribute of the the collation used for the comparison. For more information, see Trailing Space Handling in Comparisons. With  LIKE  you can use the following two wildcard characters in the pattern: • %  matches any number of characters, even zero characters. • _  matches exactly one character. mysql>  SELECT ’David!’ LIKE ’David_’; -> 1 mysql>  SELECT ’David!’ LIKE ’%D%v%’; -> 1 2187 To test for literal instances of a wildcard character, precede it by the escape character. If you do not specify the  ESCAPE  character,  \  is assumed, unless the  NO_BACKSLASH_ESCAPES  SQL mode is enabled. In that case, no escape character is used.