In a Zen-like manner, "NULL" is never equal to anything, even itself. Therefore comparisons using equality operators will always return
False
, even when the value actually IS NULL
.
For that reason, comparison operators should never be used to make comparisons with NULL
; IS NULL
and IS NOT
NULL
should be used instead.
Noncompliant code example
UPDATE books
SET title = 'unknown'
WHERE title = NULL -- Noncompliant
Compliant solution
UPDATE books
SET title = 'unknown'
WHERE title IS NULL