SQL 判斷時間是否為空


SQL 判斷時間是否為空

sql 對於時間類型的條件查詢時,先入為主地采用等於號判斷是否為空,犯了個很低級的錯誤,防止出錯記錄一下。

is null 判斷為空

select id from post where releaseTime is null

is not null 判斷不空

select id from post where releaseTime is not null

我的數據庫為 Mysql 8.0。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM