SQL Wildcards

Ever since I started with SQL i've know about the '%' wildcard. Recently i've had this desire to improve my SQL skills and I found a few new wildcards which are outlined below. % Wildcard Using the following SELECT statement I can return all players who's firstname start's with an 'A' followed by zero or more characters.

view plain print about
1SELECT * FROM yourTBL WHERE firstname LIKE 'a%'
The results

Using the following SELECT statement I can return all players who's firstname have zero or more characters followed by 'AR' followed by zero or more characters.

view plain print about
1SELECT * FROM yourTBL WHERE firstname LIKE '%ar%'
The results _ Wildcard Using '_' as a substitute for exactly one character I can return all players who's firstname start with a 'c' that is followed by any character and end with a 'sc'.
view plain print about
1SELECT * FROM yourTBL WHERE firstname LIKE 'c_sc'
The results We can do this multiple times in a string.
view plain print about
1SELECT * FROM yourTBL WHERE firstname LIKE 'th_ma_'
The results [charlist] Wildcard Using the following SELECT statement I can return all players who's firstname start's with an 'A' or 'C' or 'R' followed by zero or more characters.
view plain print about
1SELECT * FROM yourTBL WHERE firstname LIKE '[ACR]%'
The results

TweetBacks
Comments
BlogCFC was created by Raymond Camden. This blog is running version 5.9.5.004. Contact Blog Owner