天天看點

mysql資料庫字段為空的判斷_mysql怎麼判斷字段為空

mysql怎麼判斷字段為空

釋出時間:2020-06-08 17:17:02

來源:PHP中文網

閱讀:186

作者:三月

下文給大家帶來有關mysql怎麼判斷字段為空内容,相信大家一定看過類似的文章。我們給大家帶來的有何不同呢?一起來看看正文部分吧,相信看完mysql怎麼判斷字段為空你一定會有所收獲。

這裡提供了5種方法進行查詢:

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

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

is not nullselect * 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怎麼判斷字段為空,大家覺得是自己想要的嗎?如果想要了解更多相關,可以繼續關注我們的行業資訊闆塊。