Sqllike wildcard [] % instance tutorial
SQL like wildcard [] % instance tutorial
SQL like wildcard [] % instance tutorial
Note: Both mysql, SQL server, and dbms do not support text and ntext only support like wildcards.
Char, varchar, nvarchar, etc.
$ S = "select * from test where dmulplace like '% $ city % '"
Id uid parttime city
211 7117 full-time job in Changsha, Yiyang
5510 12419 full-time employment
5511 12420 full-time job in Dongguan,
209 7115 full-time employment in Changsha
Two results are recorded.
211 7117 full-time employment in Changsha
209 7115 full-time employment in Changsha
The following describes the simple description of the SQL like wildcard.
_ Match with any single character
% Matches a string that contains one or more characters.
[] Matches any single character in a specific range (for example, [a-f]) or a specific set (for example, [abcdef.
[^] Matches any single character other than a specific range (for example, [^ a-f]) or a specific set (for example, [^ abcdef ])
.
For more information about how to use the like character and add the SQL wildcard, see:
A. LIKE 'mc % 'searches all strings starting with Mc (for example, McBadden ).
B. LIKE '% inger' searches all strings ending with the letter inger (such as Ringer,
Stringer ).
C. LIKE '% en %' searches for all strings containing letters en at any position (such as Bennet,
Green, McBadden ).
D. LIKE '_ heryl' searches for names of all six letters ending with the letter heryl (for example, Cheryl,
Sheryl ).
E. LIKE '[CK] ars [eo] n' will search for the following strings: Carsen, Karsen, Carson, and Karson
(Such as Carson ).
F. LIKE '[M-Z] inger' will search for any single word ending with string inger from M to Z
All names starting with the parent (such as Ringer ).
G .. LIKE 'M [^ c] %' will search for all names starting with M, and the second letter is not c (such
MacFeather ).
Keyword: SQL like, wildcard