Logical operators

Table 1. Logical operators
Operator Description Example
AND Returns TRUE only when both the left and right operands are TRUE. a AND b
OR Returns TRUE if either the left or right operand is TRUE. a OR b
NOT Returns TRUE only when the right operand is FALSE. NOT a

NULL involved in logical operation

The following table lists the true 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