百分号%通配符
select prod_id , prod_name
from products
where prod_name like 'jet%'
select prod_id , prod_name
from products
where prod_name like '%anvi1%'
select prod_id , prod_name
from products
where prod_name like 's%e'
注意
通配符%可以表示任意字符出现的任意次数
是可以区分大小写搜索的
下划线 _ 通配符
select prod_id , prod_name
from products
where prod_name like '_ton anvi1'
select prod_id , prod_name
from products
where prod_name like '%ton anvi1'
注意
通配符_下划线表示匹配单个字符
使用通配符的技巧:
1:不要过度使用通配符。如果其他操作符能达到相同的目的一,应该使用其他操作符
2:在确实需要通配符时,除非绝对有必要,否则不要把他们用在搜索模式的开始处。把通配符置于搜索模式的开 始处,搜索起来是最慢的。
3:仔细注意通配符的位置。如果放错地方,可能不会返回想要的数据。