If I run a statement such as SELECT * FROM stuff WHERE something=NULL I will get an empty result set.
I know that the solution is to use something IS NULL. I also understand why: SQL interprets NULL as unknown, and it makes logical sense that if something is unknown, it can’t match something else.
What puzzles me is the meaning of the result set. I have always understood that you can’t match something=NULL, so why is is acceptable? It would suggest that under some circumstances, one might get a different result?
Alternatively, why does SQL not accept something=NULL as an idiom equivalent to IS NULL? It wouldn’t be the only idiom which doesn’t have a literal interpretation (such as count(*) vs SELECT *).
The question is: since something=NULL is not an error, does it mean something useful?
a=bwherebhappens to be null, you want the equality operator to automatically take on the meaning ofIS (NULL)? – Andriy M Feb 09 '17 at 20:51=NULLthat way if it has no other meaning. However, I do see in your comment the seeds of a possible explanation:WHERE A=Bmay include nulls in either side, which should be omitted.WHERE A=NULLis a specific literal which simply forces the issue. Any chance of turning something like that into an answer? – Manngo Feb 09 '17 at 20:59