Rule Definition
Comparisons with Null can never result in either True or False, but always in a third logical result, Unknown.
Remediation
To test for NULL, use the IS NULL and IS NOT NULL operators.
Violation Code Sample
SELECT AuthName FROM Authors WHERE AuthId = NULL
Fixed Code Sample
SELECT AuthName FROM Authors WHERE AuthId IS NULL
Reference
MySQL Documentation : https://dev.mysql.com/doc/refman/8.0/en/working-with-null.html
PostgreSQL Documentation : https://www.postgresql.org/docs/9.1/functions-comparison.html
Oracle Documentation : https://docs.oracle.com/database/121/SQLRF/sql_elements005.htm#SQLRF30037
SQL Server Documentation : https://docs.microsoft.com/fr-fr/sql/t-sql/language-elements/null-and-unknown-transact-sql?view=sql-server-2017
Related Technologies
Technical Criterion
CWE-480 - Use of Incorrect Operator
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.