I mostly have application development background. In programming languages variable == null
or variable != null
works.
When it comes to SQL, below queries don't give any syntax errors but don't return correct results either.
select SomeColumn from SomeTable where SomeNullableColumn=null
select SomeColumn from SomeTable where SomeNullableColumn<>null
Why do we need to write the queries with is null
or is not null
to get correct results?
select SomeColumn from SomeTable where SomeNullableColumn is null
select SomeColumn from SomeTable where SomeNullableColumn is not null
What's the reasons/requirements behind is null
or is not null
instead of =null
or <>null
?
Is this ANSI SQL or Microsoft's TSQL standard?