Boolean

AND

boolean_expr1 AND boolean_expr2

Logical conjunction between operands boolean_expr1, boolean_expr2. Returns true only when both operands evaluates to true.

Returns NULL if right side operand or both operands evaluate to NULL.

output_type:BOOLEAN

Truth table:

a b a AND b
TRUE TRUE TRUE
TRUE FALSE FALSE
TRUE NULL NULL
FALSE FALSE FALSE
FALSE NULL FALSE
NULL NULL NULL

Example:

1
dual | select(false AND true);
logical_and
false

OR

boolean_expr1 OR boolean_expr2

Logical disjunction between operands boolean_expr1, boolean_expr2. Returns true only when either of operands evaluate to true.

Returns NULL if right side operand or both operands evaluate to NULL.

output_type:BOOLEAN

Truth table:

a b a OR b
TRUE TRUE TRUE
TRUE FALSE TRUE
TRUE NULL TRUE
FALSE FALSE FALSE
FALSE NULL NULL
NULL NULL NULL

Example:

1
dual | select(false OR true);
logical_or
true

XOR

boolean_expr1 XOR boolean_expr2

Logical exclusive disjunction between operands boolean_expr1, boolean_expr2.

Returns NULL either of the operands evaluate to NULL.

output_type:BOOLEAN

Truth table:

a b a XOR b
TRUE TRUE FALSE
TRUE FALSE TRUE
FALSE TRUE TRUE
FALSE FALSE FALSE
TRUE NULL NULL
FALSE NULL NULL
NULL NULL NULL

Example:

1
dual | select(true XOR true);
logical_or
true

NOT

NOT boolean_expr

Returns negation of boolean_expr. Returns NULL if boolean_expr evaluates to NULL.

output_type:BOOLEAN

Truth table:

a NOT a
TRUE FALSE
FALSE TRUE
NULL NULL

Example:

1
dual | select(NOT true);
logical_not
false