Re: The BOOLEAN data type

From: --CELKO-- <71062.1056_at_compuserve.com>
Date: 31 Mar 2003 10:11:15 -0800
Message-ID: <c0d87ec0.0303311011.2966d628_at_posting.google.com>


>>> _When_ it's implemented, it's not clear to me which domain the
type has.
 Are all the following values allowed?:  

 true
 false
 unknown
 null  

 Does null equal unknown? <<

No, NULL is not the same as UNKNOWN and zero is not the same the empty string. But you understand why it was left out.

There were a few reason for not having it in SQL-92.

To be a datatype in SQL, you have to be NULL-able. If you allow a LOGICAL datatype, then it has to be TRUE, FALSE, UNKNOWN and be NULL-able! But NULL does not work with AND, OR and NOT. Then there is the problem that an empty scalar subquery is cast as a NULL. The CHECK() constraint in the DDL accepts predicatres that test UNKNOWN, while ON and WHERE in the DML do not. It gets to be a mess really fast.

What we did give you was a predicate "<search condition> IS [NOT] [TRUE | FALSE | UNKNOWN]" so you could test for things.

Aside from the destruction of the foundations of SQL, Booleans are usually, but not always, a sign of bad programming. Someone is storing the state of the database at one point in time as a flag. It is a computed column and we all know better than to store redundant data like that. Received on Mon Mar 31 2003 - 20:11:15 CEST

Original text of this message