Logical operators

Table 1. Logical operators
Operator Description Example
AND The result is TRUE if both values are TRUE. a AND b
OR The result is TRUE if either value is TRUE. a OR b
NOT The result is TRUE if the value is FALSE. NOT a

Effect of NULL on logical operators

The following tables list the truth values when the values of a and b are TRUE, FALSE, and NULL, respectively.

Table 2. Truth table 1
a b a AND b a OR b
TRUE TRUE TRUE TRUE
TRUE FALSE FALSE TRUE
TRUE NULL NULL TRUE
FALSE TRUE FALSE TRUE
FALSE FALSE FALSE FALSE
FALSE NULL FALSE NULL
NULL TRUE NULL TRUE
NULL FALSE FALSE NULL
NULL NULL NULL NULL
Table 3. Truth table 2
a NOT a
TRUE FALSE
FALSE TRUE
NULL NULL