Updated on 2024-05-29 GMT+08:00

Logical Operators

Logical Operators

Operation

Description

Example

AND

If both values are true, the value is true.

a AND b

OR

If one of the two values is true, the value is true.

a OR b

NOT

If the value is false, the result is true.

NOT a

The following truth table reflects how AND and OR handle NULL values.

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

The following truth table reflects how NOT handle NULL values.

value

NOT value

TRUE

FALSE

FALSE

TRUE

NULL

NULL