Re: Implementation of boolean types.
Date: 14 Jul 2005 07:17:39 -0700
Message-ID: <1121350659.397618.4400_at_g49g2000cwa.googlegroups.com>
NULL is not a logical value and UNKNOWN is. Look up the truth tables
in any SQL book.
Q: Now what is the first and most important rule of NULLs?
A: NULLs propagate in computations!
That means we should have these rules for Boolean types:
NULL AND TRUE = NULL
NULL AND FALSE = NULL
NULL AND NULL = NULL
NULL OR FALSE = NULL
NULL OR NULL = NULL
NOT NULL= NULL -- valid but really weird looking, unh?
However, in 3VL we have these rules
UNKNOWN AND TRUE = UNKNOWN
UNKNOWN AND FALSE = FALSE <== opps! not the same as NULL
UNKNOWN AND UNKNOWN = UNKNOWN
UNKNOWN OR TRUE = TRUE <== opps! not the same as NULL
UNKNOWN OR FALSE = UNKNOWN
UNKNOWN OR UNKNOWN = UNKNOWN
NOT UNKNOWN = UNKNOWN
So, which of the three values does a NULL map to? The results of
logical expressions now depend on the order of execution and
substitution of UNNOWN and NULL
Received on Thu Jul 14 2005 - 16:17:39 CEST