mysql模糊查询语句like与not like的使用与区别
mysql模糊查询like的用法
查询user表中姓名中有“王”字的:
1 | select * from user where name like '%王%' |
|
mysql模糊查询not like的用法
查询user表中姓名中没有“王”字的:
1 | select * from user where name not like '%王%' |
|
查询user表中地址在上海姓名中没有“王”字和所有姓名为空的:
1 | select * from user where adress =‘上海’ and name not like '%王%' or name is null |
|
查询user表中地址在上海姓名中没有“王”字和地址在上海姓名为空的:
1 | select * from user where adress =‘上海’ and (name not like '%王%' or name is null) |
|
文章源自飞鸟学习网-https://www.pk88.net/2022-0407-3.html文章源自飞鸟学习网-https://www.pk88.net/2022-0407-3.html全站资源源于网络整合,仅供学习研究,不可商用,不提供技术指导,如有侵权请告知删除,可以投稿,广告合作联系V: pk88net
评论