SQL Server
SELECT * FROM t WHERE is_active = 1;
The BIT type stores 0 and 1 only; TRUE and FALSE are not keywords, so the literal is the number.
TRUE is a keyword in four engines, but only PostgreSQL and Oracle 23ai back it with a real type. SQL Server has no TRUE at all.
Filed under Types & casting
PostgreSQL and Oracle 23ai are the only engines where TRUE is a literal of a real boolean type. MySQL and SQLite accept TRUE but store 1, and SQL Server filters BIT columns with = 1. The convention lives in the schema, so check the column type before writing the predicate.
How you write true and false depends entirely on the column type underneath. The rows below filter an active flag in each engine's native convention.
SELECT * FROM t WHERE is_active = 1;
The BIT type stores 0 and 1 only; TRUE and FALSE are not keywords, so the literal is the number.
SELECT * FROM t WHERE is_active = TRUE;
A real BOOLEAN type accepts TRUE, FALSE, and the literals 't', 'f', 'yes', 'no', '1', '0' when quoted.
SELECT * FROM t WHERE is_active = TRUE;
TRUE is just an alias for 1; a BOOLEAN column is really TINYINT(1) and happily stores 7.
SELECT * FROM t WHERE is_active = 1;
No boolean type: flags are integers. The TRUE and FALSE keywords are recognized (3.23+) and evaluate to 1 and 0.
SELECT * FROM t WHERE is_active = 1;
Before 23ai there is no SQL BOOLEAN, so flags are NUMBER(1) 0/1, as here, or CHAR(1) 'Y'/'N'. On a 23ai BOOLEAN column, WHERE is_active = TRUE and a bare WHERE is_active both work.
There is no TRUE keyword there. Use is_active = 1. A bare WHERE is_active fails too (Msg 4145): SQL Server wants a comparison even on BIT columns.
No. BOOLEAN is an alias for TINYINT(1), and any integer value is accepted. TRUE/FALSE literals simply mean 1/0.
It is a widespread legacy convention and readable in data dumps, but NUMBER 0/1 or (from 23ai) BOOLEAN compares more naturally and indexes the same. Pick one convention and stick to it.
Where the UUID can be a real type, and where it is 16 bytes wearing a costume.
Blank-padding is invisible until a join compares CHAR to VARCHAR and stops matching.
In Oracle, '' IS NULL is true. Everywhere else it is false. That one fact rewrites your WHERE clauses.
SQLly is a native SQL workbench for macOS, Windows and Linux. Its formatter and plan viewer work in all five dialects.