Many folks think of NULL as being the same as zero or the empty string (''). Not only is this not true, NULL is not even the same as NULL. NULL really means, "The value is unknown". Consider the Middle Name field for two contacts:
The answers to these questions are obvious:
Translate this into SQL, the results may seem odd, unless you consider the real-world questions above:
How can using equals and not equals BOTH be false? Well, comparing unknown to anything is, well, unknown. If the answer is unknown, but you require SQL to give you a true or false answer, SQL will return false. If you want to consider whether something is actually unknown, use IS NULL:
It is possible to override this behavior in SQL, but it is generally a very bad idea. |
Configuration >