A native data type representing a true/false value, stored and queried without numeric or string proxies.

Stores true/false values. Some databases store as integer (0/1) internally. NULL represents unknown, distinct from FALSE. Boolean columns are more self-documenting than integer or string representations and enable proper three-valued logic.

Compatibility

Show:
Database System Support Status Since Version Notes
MySQL ✓ Supported 5.0 BOOLEAN and BOOL are aliases for TINYINT(1). Values are stored as 0/1; TRUE and FALSE are just aliases for 1 and 0. Comparisons like WHERE is_active = TRUE work but WHERE is_active IS TRUE does not.
PostgreSQL ✓ Supported 7.4 True native BOOLEAN type. Accepts 'true', 'false', 't', 'f', 'yes', 'no', '1', '0' as input literals. IS TRUE / IS FALSE predicates work correctly and handle NULLs distinctly.
SQL Server ✗ Not Supported No BOOLEAN or BOOL type. Use BIT (0, 1, or NULL). BIT columns cannot be used directly in WHERE without comparison: WHERE is_active = 1, not WHERE is_active.
Oracle ✓ Supported 23c Native BOOLEAN column type added in Oracle 23c. In earlier versions, use NUMBER(1) with a CHECK(col IN (0,1)) or CHAR(1) with CHECK(col IN ('Y','N')). PL/SQL has always had a BOOLEAN type but it was not usable in SQL or as a column type prior to 23c.
SQLite ✓ Supported 3.0.0 SQLite has no separate BOOLEAN storage class — values are stored as integers 0 and 1. The keywords TRUE and FALSE are recognized as integer literals 1 and 0 since SQLite 3.23.0.

Details

Only PostgreSQL has a true, fully-featured BOOLEAN type. MySQL's BOOLEAN is transparently TINYINT(1), which means any integer value can be inserted, not just 0 and 1, and IS TRUE / IS FALSE predicates behave differently than in PostgreSQL. SQL Server's BIT is the closest equivalent but cannot be used as a standalone expression in WHERE — it always requires an explicit comparison operator. Oracle only gained a SQL-level BOOLEAN column type in 23c; before that, PL/SQL had BOOLEAN but it was unusable in DDL or plain SQL queries, forcing teams to use numeric or character proxies. When writing cross-engine code, the safest portable pattern is a SMALLINT or TINYINT column constrained to 0 and 1 with a CHECK constraint, compared with = 1 / = 0.

Standard Syntax

CREATE TABLE flags ( is_active BOOLEAN NOT NULL DEFAULT TRUE );

Version Support

MySQL: Since 5.0 PostgreSQL: Since 7.4 SQL Server: Not supported Oracle: Since 23c SQLite: Since 3.0.0

Per-Database Syntax & Notes

MySQL

BOOLEAN and BOOL are aliases for TINYINT(1). Values are stored as 0/1; TRUE and FALSE are just aliases for 1 and 0. Comparisons like WHERE is_active = TRUE work but WHERE is_active IS TRUE does not.

CREATE TABLE flags (is_active BOOLEAN NOT NULL DEFAULT TRUE); -- Stored as TINYINT(1): SELECT * FROM flags WHERE is_active = 1; SELECT * FROM flags WHERE is_active = TRUE; -- same thing

PostgreSQL

True native BOOLEAN type. Accepts 'true', 'false', 't', 'f', 'yes', 'no', '1', '0' as input literals. IS TRUE / IS FALSE predicates work correctly and handle NULLs distinctly.

CREATE TABLE flags (is_active BOOLEAN NOT NULL DEFAULT TRUE); SELECT * FROM flags WHERE is_active; SELECT * FROM flags WHERE is_active IS TRUE;

SQL Server

No BOOLEAN or BOOL type. Use BIT (0, 1, or NULL). BIT columns cannot be used directly in WHERE without comparison: WHERE is_active = 1, not WHERE is_active.

CREATE TABLE flags (is_active BIT NOT NULL DEFAULT 1); SELECT * FROM flags WHERE is_active = 1;

Oracle

Native BOOLEAN column type added in Oracle 23c. In earlier versions, use NUMBER(1) with a CHECK(col IN (0,1)) or CHAR(1) with CHECK(col IN ('Y','N')). PL/SQL has always had a BOOLEAN type but it was not usable in SQL or as a column type prior to 23c.

-- Oracle 23c+: CREATE TABLE flags (is_active BOOLEAN NOT NULL DEFAULT TRUE); -- Pre-23c: CREATE TABLE flags (is_active NUMBER(1) DEFAULT 1 CHECK (is_active IN (0,1)));

SQLite

SQLite has no separate BOOLEAN storage class — values are stored as integers 0 and 1. The keywords TRUE and FALSE are recognized as integer literals 1 and 0 since SQLite 3.23.0.

CREATE TABLE flags (is_active INTEGER NOT NULL DEFAULT 1); -- TRUE/FALSE literals (3.23.0+): SELECT * FROM flags WHERE is_active = TRUE;