NULL judgment in MySQL

Query a field is not NULL, when using the following statement, the MySQL parser will filter the data if the field is null as if it meets the condition of inequality.

select * from tb_emp where comm <> null

The correct approach is:

select * from tb_emp where comm is not null

Conclusion:
When judging and processing NULL, you can only use IS NULL or IS NOT NULL, not =, <, <>,! =

Published 460 original articles · praised 812 · 90,000 views

Guess you like

Origin blog.csdn.net/lianghecai52171314/article/details/105584034