On the Wikipedia page for SQL there are some truth tables about boolean logic in SQL. [1] The Wikipedia page seems to source the SQL:2003 standard.
The truth table for the equals operator (=) is different from the IS operator from the SQL:2003 draft.
Also, the Wikipedia article notes that "IS NULL" (<null predicate>) is a special case.
In the SQL:2003 it seems that there is an "IS" opeartor which is a regular operator like AND, NOT and OR. However, the <null predicate> is still there.
Why is the <null predicate> there when the IS is a regular boolean operator? Is it to make sure you can use the "IS NULL" construct with non-boolean values without type coersion? Is it discouraged to use "=NULL"?
Does the SQL:2011 standard work differently?
[1]: Wikipedia on SQL
[2]: SQL:2011 draft PDF page 335
[3]: SQL:2003 draft PDF page 397
NULL = NULL
,NULL = 1
and1 = NULL
are all false (Well, really they're allNULL
/Unknown
which is not true and so is really close to being false). ButNULL IS NULL
is true. – PhonoSQLite
has anIS
operator that is interchangeable with=
except for it has the semantics thatNULL=NULL
. – Radloff<from clause>
– RadloffIS TRUE
,IS FALSE
,IS UNKNOWN
are special predicates for dealing with the boolean datatype. This product seems to use them – RadloffIS
though... – Radloff