数据表格,创造数据都在上篇文章MySQL常用语句里,可以在我的栏目里看到。
这篇写MySQL用通配符进行过滤
查找以Ra开头的生产商提供的产品
select prod_id,prod_name,vend_id from products where prod_name like 'Ra%'
查找名字中包含bean bag的产品
select prod_id,prod_name,vend_id from products where prod_name like '%bean bag%';
查找邮箱名字中以j开头,以@fun4all.com结尾
select cust_name,cust_email from customers where cust_email like 'j%@fun4all.com';
查找名字__ inch teddy bear的产品,__两个下划线代替两个字母
select prod_id,prod_name,vend_id from products where prod_name like '__ inch teddy bear';
查找名字% inch teddy bear的产品,%代替inch teddy bear前面的字母
select prod_id,prod_name,vend_id from products where prod_name like '% inch teddy bear';