A Boolean <data type> is defined by a descriptor that contains one piece of information: The <data type>'s name: BOOLEAN.
BOOLEAN
The required syntax for a BOOLEAN <data type> specification
is:
BOOLEAN ::= BOOLEAN
BOOLEAN defines a set of truth values: either
TRUE, FALSE or
UNKNOWN (as the null value).
The SQL Standard doesn't differentiate between BOOLEAN's
null value (that is, UNKNOWN) and the
UNKNOWN truth value that is returned by an SQL predicate,
search condition or by any argument or expression that returns a Boolean value
— it allows both to be used interchangeably to mean
the same thing. Warning: by saying that UNKNOWN and
NULL are the same thing, one is saying that the answers "I
don't know" and "I know that the data is missing" are the same thing. The
drafters of the SQL Standard apparently forgot the distinction, and they have
been justly criticized for this error.
If you want to restrict your code to Core SQL, don't define any
BOOLEAN <data type>s.
Now that we've described SQL's Boolean <data type>, let's look at some example SQL statements that put it to use.
These SQL statements make a Table with three Boolean Columns, insert a row, then search for a pair of equal Column values.
CREATE TABLE Logicals ( boolean_1 BOOLEAN, boolean_2 BOOLEAN, boolean_3 BOOLEAN); INSERT INTO Logicals ( boolean_1, boolean_2, boolean_3) VALUES (TRUE,FALSE,UNKNOWN); SELECT boolean_1 FROM Logicals WHERE boolean_1 = boolean_3;