DEV Community

AquaCat
AquaCat

Posted on

【MySQL】When using "NULL" in WHERE CLAUSE

Do not write

SELECT * FROM [table_name] WHERE [column_name]=NULL;
Enter fullscreen mode Exit fullscreen mode

Use "IS" for NULL!!!!

SELECT * FROM [table_name] WHERE [column_name] IS NULL;
Enter fullscreen mode Exit fullscreen mode

I wasted 2hours for this...

Top comments (0)