Re: The BOOLEAN data type
Date: 31 Mar 2003 10:11:15 -0800
>>> _When_ it's implemented, it's not clear to me which domain the
Are all the following values allowed?:
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