I have a table called NUMS with one column n.
And I fill in the values 1,2,3,4,5, zero in it.
Now request
SELECT n FROM Nums
WHERE n IN (1, 2, null)
In this case, I think it is converted to
SELECT n FROM Nums
Where n = 1 OR n = 2 OR n = null
I also compare n with a null value, which should produce the unknown, and it should return an empty set. But it returns 1.2 (null is not returned, although it is included in the IN statement)
Now request
SELECT n FROM Nums WHERE n NOT IN(1, 2, null)
... converts to:
SELECT n FROM Nums
Where n!=1 AND n!=2 AND n!=null
Here, what I said above works and returns nothing.
Can someone explain in detail what is happening.
source
share