BOOLEAN Data Type
The ISO SQL:1999 standard introduced the BOOLEAN data type to SQL, however it's still just an optional, non-core feature, coded T031.
When restricted by a NOT NULL
constraint, the SQL BOOLEAN works like the Boolean type from other languages. Unrestricted however, the BOOLEAN datatype, despite its name, can hold the truth values TRUE, FALSE, and UNKNOWN, all of which are defined as boolean literals according to the standard. The standard also asserts that NULL and UNKNOWN "may be used interchangeably to mean exactly the same thing".
The Boolean type has been subject of criticism, particularly because of the mandated behavior of the UNKNOWN literal, which is never equal to itself because of the identification with NULL.
As discussed above, in the PostgreSQL implementation of SQL, the null value is used to represent all UNKNOWN results, including the UNKNOWN BOOLEAN. PostgreSQL does not implement the UNKNOWN literal (although it does implement the IS UNKNOWN operator, which is an orthogonal feature.) Most other major vendors do not support the Boolean type (as defined in T031) as of 2012. The procedural part of Oracle's PL/SQL supports BOOLEAN however variables; these can also be assigned NULL and the value is considered the same as UNKNOWN.
Read more about this topic: Null (SQL)
Famous quotes containing the words data and/or type:
“Mental health data from the 1950s on middle-aged women showed them to be a particularly distressed group, vulnerable to depression and feelings of uselessness. This isnt surprising. If society tells you that your main role is to be attractive to men and you are getting crows feet, and to be a mother to children and yours are leaving home, no wonder you are distressed.”
—Grace Baruch (20th century)
“They had supposed their formula was fixed.
They had obeyed instructions to devise
A type of cold, a type of hooded gaze.
But when the Negroes came they were perplexed.
These Negroes looked like men....”
—Gwendolyn Brooks (b. 1917)