Most RDBMS' do not support a native Boolean type; Postgres is one of the few that actually does, allowing the programmer use a native Boolean type in both their application code and database code. Oracle, and many others, does not at all, and so most programmers resort to some sort of convention whereby the set of values of a Boolean-like column is restricted to 1
or 0
, or 'T'
or 'F'
, or 'Y'
, or 'N'
.
SQLite is in a third category; it does support a Boolean type but the boolean
keyword is actually a synonym for the tinyint
type, and the values are actually managed in the database as 1 for true
, and 0 for false
. Moreover, when you query the database, you only get back out the tinyint
representations. This complicates matters if you wish to take advantage of the boolean
type in the database and in your application code without having to constantly transform values both in and out of it.
Here's an example; let's create a brand new database: