The like keyword searches for the string, date, or time value that matches the specified pattern. For more information, see data types. The like keyword uses the regular expression to include the pattern to be matched by the value. The mode contains the string to be searched. A string can contain any combination of four wildcard characters.
| Wildcard |
Description |
| % |
Any string containing zero or more characters. |
| _ |
Any single character. |
| [] |
Specifies any single character in the range (for example, [a-f]) or set (for example, [abcdef. |
| [^] |
Any single character that is not in the specified range (for example, [^ a-f]) or set (for example, [^ abcdef. |
Use single quotes to enclose wildcards and strings. For example:
- like 'mc % 'searches all strings starting with MC (for example, mcbadden ).
- like '% Inger' searches all strings ending with the letter Inger (such as ringer and Stringer ).
- like '% en %' searches all strings (such as Bennet, green, and mcbadden) that contain letters en at any position ).
- like '_ heryl' searches for names (such as Cheryl and Sheryl) of all six letters ending with heryl ).
- like '[Ck] ARS [EO] n' searches for the following strings: Carsen, Karsen, Carson, and karson (such as Carson ).
- like '[M-Z] Inger' searches for all names (such as ringer) ending with string Inger, starting with any single letter from m to Z ).
- like'm [^ C] %' searches for all names (such as macfeather) Starting with m, and the second letter is not C ).