SQL Boolean Data Type

Actually three-valued, not two — TRUE, FALSE, and NULL are all valid states.

What & Why

A BOOLEAN column holds TRUE or FALSE — but like every column type, it can also hold NULL, meaning "unknown" rather than either value. This is genuinely three-valued logic, not simple binary.

See How It Works

BOOLEAN RESULT — product.feedback
iduser_idnps_scoreis_promoter
11019TRUE
2102NULLNULL
31037FALSE
4104NULLNULL

The comparison `nps_score >= 8` produces a Boolean value: `TRUE` for 9, `FALSE` for 7, and `NULL` when the score itself is unknown.

EXAMPLE QUERY
SELECT id, user_id, nps_score,
  nps_score >= 8 AS is_promoter
FROM product.feedback;
Beginner business practice

Sign up free to try it on a real business scenario