In my db there is a varchar(255) column and for some records it contains null values, when i fired this
SELECT * FORM my_table where some_column <> NULL;
nothing is returned
but when is fired
SELECT * FORM my_table where some_column IS NOT NULL;
I got desired records
can you explain what's the main difference between them and when to use <> and != operators.
NULLin SQL. For all practical purposes, the first is a typo.NULL <> NULLisNULL, not true. ComparingNULLto any other value includingNULLis alwaysNULLand therefore not true, regardless of the comparison operator, unless it isIS NULLorIS NOT NULL.some_column = NULLalways returns false. Alsosome_column <> NULLalways returns false.UNKNOWN/NULL. If your assertion was correctNOT (some_column = NULL)would be true.