Mega Code Archive

 
Categories / MySQL Tutorial / String Functions
 

Expr LIKE pat [ESCAPE escape_char]

Pattern matching using SQL simple regular expression comparison. Returns 1 (TRUE) or 0 (FALSE). If either expr or pat is NULL, the result is NULL. With LIKE you can use the following two wildcard characters in the pattern: CharacterDescription %Matches any number of characters, even zero characters _Matches exactly one character mysql> mysql> SELECT 'ABCDE!' LIKE 'ABCDE_'; +------------------------+ | 'ABCDE!' LIKE 'ABCDE_' | +------------------------+ |                      1 | +------------------------+ 1 row in set (0.00 sec) mysql> mysql> SELECT 'ABCDE!' LIKE '%A%C%'; +-----------------------+ | 'ABCDE!' LIKE '%A%C%' | +-----------------------+ |                     1 | +-----------------------+ 1 row in set (0.00 sec)