Logical type

  • BOOL

    • Alias: BOOLEAN

Description

The BOOL type represents a truth statement and can take the values:
true, false (boolean values) or NULL.

Boolean values can be explicitly specified using true and false literals. Most often, however, they are created as a result of a comparison. For example, the comparison i > 10 returns a Boolean value.

Boolean values can be used in the expressions WHERE and HAVING to filter results. In this case, expressions whose result evaluates to true will pass the filter, and expressions whose result evaluates to false or NULL will be discarded.

Logical operators

The logical operators AND and OR can be used to combine Boolean values.

Truth table for the AND operator
X X AND true X AND false X AND NULL

true

true

false

NULL

false

false

false

false

NULL

NULL

false

NULL

Truth table for the OR operator
X X OR true X OR false X OR NULL

true

true

true

true

false

true

false

NULL

NULL

true

NULL

NULL