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