Skip to main content

BOOLEAN Type

The BOOLEAN data type in SQL is used to represent logical values and is primarily used for conditions and decision-making in queries. It can take one of these two possible states: TRUE: Indicates that the condition is met or the logical expression evaluates to true. FALSE: Indicates that the condition is not met or the logical expression evaluates to false.

Syntax

BOOLEAN

Limits

Supports TRUE and FALSE.

Literals

{ TRUE | FALSE }

Examples

> SELECT TRUE;
TRUE

> SELECT CAST('false' AS BOOLEAN);
FALSE

> SELECT CAST(0 AS BOOLEAN);
FALSE

> SELECT CAST(-1 AS BOOLEAN);
TRUE