Re:Easy Steps to a Complete Understanding of SQL
by lukaseder on Tuesday September 03, 2013 @10:37AM
(#6321210)
> which ultimately causes he Boolean expression to be false
Strictly speaking, the boolean expression is also UNKNOWN ;-) I've tried to explain this here: http://blog.jooq.org/2012/01/27/sql-incompatibilities-not-in...
... but to this date, I'm still not 100% sure if I correctly understood SQL NULL. A quite worrying thing is documented here: http://blog.jooq.org/2012/12/24/row-value-expressions-and-th...
It's about row value expressions and NULL predicates. The following are not the same!
(A, B) IS NOT NULL
NOT((A, B) IS NULL)
> I hope that redeems my reputation a little :-)You're forgiven ;-) Thanks!
Re:Easy Steps to a Complete Understanding of SQL
by chris_wot on Tuesday September 03, 2013 @10:53AM
(#6321294)
Darn it, right again. Sigh.
Those expressions can be worked out via first order predicate logic. Damned tricky, I can definitely see how that would trip up pretty much anyone at first glance. If you weren't aware of logical equivalences then you might be scratching your head for some time!
Another great article, btw.
The reason being is that IN uses an disjunction and NOT IN uses a conjunction. When you compare the value to NULL it returns UNKNOWN, which ultimately causes the Boolean expression to be false.
I hope that redeems my reputation a little :-)
Btw, great article!