温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

mysql怎么判断字段为空

发布时间:2020-06-08 17:17:02 来源:PHP中文网 阅读:309 作者:三月 栏目:MySQL数据库

下文给大家带来有关mysql怎么判断字段为空内容,相信大家一定看过类似的文章。我们给大家带来的有何不同呢?一起来看看正文部分吧,相信看完mysql怎么判断字段为空你一定会有所收获。                                                          

这里提供了5种方法进行查询:

isnull()

select * from users where email = 'xxxx' and isnull(deletedAt)

is null

select * from users where email = 'xxxx' and deletedAt is null

is not null

select * from users where email = 'xxxx' and deletedAt is not null

!isnull()

select * from users where email = 'xxxx' and !isnull(deletedAt) 
select * from users where email = 'xxxx' and not isnull(deletedAt)

isfull

当查询条件为 null,用指定字符替代

select name,  isfull(gender,'未知') as gender  from users where email = 'xxxx'

对于上文关于mysql怎么判断字段为空,大家觉得是自己想要的吗?如果想要了解更多相关,可以继续关注我们的行业资讯板块。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI