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