Logical operators

Logical operators evaluate Boolean expressions and determine whether the entire expression is true or false based on the operator used.

You can use logical operators to do the following:

  • Construct simple queries that return true, false, or unknown results using Boolean logic.
  • Perform queries using combinations of logical operators that are not available to use with the Record list query method, use the Retrieving records method from the query window.
Operator Symbol Usage Operation
AND & value AND value Returns TRUE if both component conditions are TRUE. Returns FALSE if either is FALSE. Otherwise returns UNKNOWN.
OR | value OR value Returns TRUE if either component condition is TRUE. Returns FALSE if both are FALSE. Otherwise returns UNKNOWN.
NOT ~ not value Returns TRUE if the following condition is FALSE. Returns FALSE if it is TRUE. If it is UNKNOWN, then it remains UNKNOWN.

Logical operators take precedence in the following order: (1) NOT, (2) AND, (3) OR.

Results of applying the NOT operation to an expression:

-- TRUE FALSE UNKNOWN
NOT FALSE TRUE UNKNOWN

Results of combining two expressions by using AND:

AND TRUE FALSE UNKNOWN
TRUE TRUE FALSE UNKNOWN
FALSE FALSE FALSE FALSE
UNKNOWN UNKNOWN FALSE UNKNOWN

Results of combining two expressions by using OR:

OR TRUE FALSE UNKNOWN
TRUE TRUE TRUE TRUE
FALSE TRUE FALSE UNKNOWN
UNKNOWN TRUE UNKNOWN UNKNOWN