select 'true' from dual where 1 not in (null,1);
when we execute this which will result nothing
what my question is:
is the above query is logically equivalent to
select 'true' from dual where 1 != null and 1 != 1;
which will result nothing just as above statement
Please clarify?
Correct (but note that
INis an operator, not a clause and it works like this in SQL in general, not only for Oracle).is equivalent to:
which should really be written as:
and
which is the same as:
which evaluates to:
and further as:
So, it correctly returns no rows.
Notice that if you had
WHERE 1 NOT IN (NULL, 2), it would evaluate toWHERE UNKNOWN(left as an exercise) and no rows would be returned either.