首页 > 其他 > 详细

通配符 空值

时间:2020-05-31 19:50:57      阅读:98      评论:0      收藏:0      [点我收藏+]

通配符主要用于字符串的查询和匹配

_    :匹配一个字符   

  select * from mytable where name like ‘张_‘

  查询条件张姓,姓名2个字

%   :匹配多个字符

  select * from mytable where name like ‘张%‘

  查询条件 张姓

[]    :范围或转义

  select * from mytable where name like ‘张[0-9]‘    --查询条件 张0---张9

  select * from mytable where name like ‘张[a-z]‘    --查询条件 张a---张z

  select * from mytable where name like ‘张[%]‘    --查询条件 张%

 ^   :非

  select * from mytable where name like ‘张[^a]‘    --查询条件  张姓  ,名字非a

  select * from mytable where name not  like ‘张[a]    --和上面的结果不同

is null   空值 ; is not null  非空

   select * from mytable where name is null     --查询条件name为空

任何与null 运行的结果,都是 null

  select 2000 + null  --结果为null

通配符 空值

原文:https://www.cnblogs.com/boentouch/p/13020048.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!