NULL is the indefinite, indeterminate and indefinable. It is not false, but neither is it true. Neither 8 nor 80. It is not a value, but a lack of one. Because it is not a value, it can be considered a status . A state of undefined.
By having this definition, when comparing
NULL using standard comparators (equal, different from, greater than, less than, greater than, less than equal) will always result in
SELECT NULL = 0 // => false
SELECT NULL != 0 // => false
SELECT NULL = NULL // => false
Everything that compares to
NULL , is false. This is explained by the fact that
NULL is the absence of value, the undefined and the lack of a value.
To understand better, I like to say that it evaluates to false because it can not be said to be true.
Think of a hypothetical table in a database that holds records of people:
| ID | Nome | Idade |
| 1 | João | NULL |
| 2 | Maria | 19 |
| 3 | José | NULL |
Then, I ask the following questions for the database:
How old is Maria? 19.
How old is John? I do not know.
Is Mary and John the same age? I can not say that. Neither false, nor true.
The same happens (3) with the question "Are John and Joseph the same age?".
That's why comparisons with
NULL need special treatment. And then the
IS NULL appeared.