当我们须要晓得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推断字段是不是为空的细致内容,更多请关注ki4网别的相干文章!