Could someone please explain the following behavior in SQL?
SELECT * FROM MyTable WHERE MyColumn != NULL (0 Results)
SELECT * FROM MyTable WHERE MyColumn <
In SQL, anything you evaluate / compute with NULL
results into UNKNOWN
This is why SELECT * FROM MyTable WHERE MyColumn != NULL
or SELECT * FROM MyTable WHERE MyColumn <> NULL
gives you 0 results.
To provide a check for NULL
values, isNull function is provided.
Moreover, you can use the IS
operator as you used in the third query.
Hope this helps.