and and or

and connects two expressions and returns results when both are true. or connects two or more conditions and returns results when either condition is true.

When more than one logical operator is used in a statement, and is evaluated before or. Use parentheses to change the order of execution.

Table 1-9 shows the results of logical operations, including those that involve null values:

Table 1-9: Truth tables for logical expressions

and

TRUE

FALSE

NULL

TRUE

TRUE

FALSE

UNKNOWN

FALSE

FALSE

FALSE

FALSE

NULL

UNKNOWN

FALSE

UNKNOWN

or

TRUE

FALSE

NULL

TRUE

TRUE

TRUE

TRUE

FALSE

TRUE

FALSE

UNKNOWN

NULL

TRUE

UNKNOWN

UNKNOWN

not

TRUE

FALSE

FALSE

TRUE

NULL

UNKNOWN

The result UNKNOWN indicates that one or more of the expressions evaluates to NULL, and that the result of the operation cannot be determined to be either TRUE or FALSE.