Because NULL stands for UNKNOWN , and when you compare a value with UNKNOWN , the result will always be false.
Take a look at these comparisons -
NULL = NULL -- false, since both are unknown, so the truth value of this expression can't be determined. NULL = 4 -- false 4 = 4 -- true, since both values are known.
If you want to get records containing NULL , you need to re-write the query this way -
where fk <> 4 OR fk is null;
For more information, see Wikipedia .
MD Sayem Ahmed
source share