For what it's worth, comparing something with NULL is not strictly false, it is unknown. In addition, NOT unknown.
ANSI SQL-99 defines the IS [NOT] DISTINCT FROM predicate. This allows you to mix null values ββand non-zero values ββin comarisons and always get true or false. Null compared to null in this case is true, otherwise any non-zero compared to zero false. Thus, denial works as you probably expect.
PostgreSQL, IBM DB2, and Firebird support IS [NOT] DISTINCT FROM .
MySQL has a similar operator with zero security <=> , which returns true if the operands are the same and false if they are different.
Oracle has the most difficult way. You must become creative using NVL() or Boolean expressions:
WHERE a = b OR (a IS NULL AND b IS NULL)
Ugh.
source share