微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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怎么判断字段为空,大家觉得是自己想要的吗?如果想要了解更多相关,可以继续关注我们的行业资讯板块。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐