On 6 December 2011 12:00, Adarsh Sharma <adarsh.sharma@orkash.com> wrote:
>> select * from table where lat IS NULL;
> can you explain how it works or any link that explain the difference between
> 2 queries.
That's because of the 3-valued logic of SQL.
x=NULL always evaluates to NULL, because it is unknown whether the
two might be equal or not.
x IS NULL checks whether x is known (NOT NULL) or not (NULL) and
evaluates to TRUE or FALSE based on that.
WHERE-clauses only return rows where the expression evaluates to TRUE
and not rows where it evaluates to NULL or (obviously) FALSE.
--
If you can't see the forest for the trees,
Cut the trees and you'll see there is no forest.