xhnewbie

mysql模糊查询like的用法

查询user表中姓名中有“王”字的:

select * from user where name like \'%王%\'

mysql模糊查询not like的用法

查询user表中姓名中没有“王”字的:

select * from user where name not like \'%王%\'

查询user表中地址在上海姓名中没有“王”字和所有姓名为空的:

select * from user where adress =‘上海’ and name not like \'%王%\' or name is null

查询user表中地址在上海姓名中没有“王”字和地址在上海姓名为空的:

select * from user where adress =‘上海’ and (name not like \'%王%\' or name is null)

分类:

技术点:

相关文章:

  • 2021-11-29
  • 2021-09-27
  • 2021-11-08
  • 2021-08-07
猜你喜欢
  • 2022-12-23
  • 2022-03-01
  • 2021-08-07
  • 2021-05-14
  • 2021-10-04
  • 2022-02-06
  • 2022-12-23
相关资源
相似解决方案