tacnode

Logical Operators

Logical Operators

The usual logical operators are available:

boolean AND booleanboolean
boolean OR booleanboolean
NOT booleanboolean

SQL uses a three-valued logic system with true, false, and null, which represents “unknown”. Observe the following truth tables:

aba AND ba OR b
TRUETRUETRUETRUE
TRUEFALSEFALSETRUE
TRUENULLNULLTRUE
FALSEFALSEFALSEFALSE
FALSENULLFALSENULL
NULLNULLNULLNULL
aNOT a
TRUEFALSE
FALSETRUE
NULLNULL

The operators AND and OR are commutative, that is, you can switch the left and right operands without affecting the result. (However, it is not guaranteed that the left operand is evaluated before the right operand. See Section 3.2.14 for more information about the order of evaluation of subexpressions.)

On this page