Reputation: 19
Why didn't the query return any rows?
SELECT 1 FROM sysibm.sysdummy1 WHERE 1 NOT IN (2, NULL)
Upvotes: 1
Views: 43
Reputation: 12314
1 NOT IN (2, NULL)
is equal to 1 <> 2 AND 1 <> NULL
The result of 1 <> NULL
is UNKNOWN
, so, the result of the original expression is:
TRUE AND UNKNOWN
which is UNKNOWN
.
But you get the result for rows, where an expression in WHERE evaluates as TRUE
only.
Upvotes: 1