Logical operators

Vertica supports the logical operators AND, OR, and NOT:.

Vertica supports the logical operators AND, OR, and NOT:

  • AND evaluates to true when both of the conditions joined by AND are true.

  • OR evaluates to true when either condition is true.

  • NOT negates the result of any Boolean expression.

AND and OR are commutative—that is, you can switch left and right operands without affecting the result. However, the order of evaluation of sub-expressions is not defined. To force evaluation order, use a CASE construct.

Logic

SQL uses a three-valued Boolean logic where NULL represents "unknown":

  • true AND NULL = NULL

  • true OR NULL = true

  • false AND NULL = false

  • false OR NULL = NULL

  • NULL AND NULL = NULL

  • NULL OR NULL = NULL

  • NOT NULL = NULL