Skip to content

Logical (Boolean) Operators

A logical operator is a function that returns a truth value for one or two input arguments.

The return values of logical operators can only be used as predicates. A predicate is an expression commonly used in the search condition of a WHERE clause, a HAVING clause, or in the join condition of FROM clauses, where a Boolean value is required.

Summary Table

OperatorSyntaxRemarks
ANDa AND bTrue if both expressions a and b are true.
NOTNOT aTrue if the expression a is not true.
ORa OR bTrue if at least one of the expressions (a or b) is true.

Operator Precedence

Operators are evaluated in the following precedence order:

  • NOT
  • AND
  • OR.