Examples of using wildcards in LIKE

Examples of using wildcards in LIKE
select * from test;
x
——–
abc
cba
dba
cab
e_ab

(5 row(s) affected)

select * from test where x like ‘[ac]%’
x
——–
abc
cba
cab

(3 row(s) affected)

select * from test where x like ‘[^ac]%’

x
——–
dba
e_ab

(2 row(s) affected)

select * from test where x like ‘[a-c]%’;

x
——–
abc
cba
cab

(3 row(s) affected)

select * from test where x LIKE ‘%/_%’ ESCAPE ‘/’

x
——–
e_ab

(1 row(s) affected)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s