Updated on 2025-08-25 GMT+08:00

Logical Operators

Common logical operators include AND, OR, and NOT. The operation results are TRUE, FALSE, and NULL, where NULL indicates unknown. The operation precedence order is: NOT > AND > OR.

For detailed calculation rules, refer to Table 1, where a and b represent logical expressions.

Table 1 Operation rules

a

b

Result of a AND b

Result of a OR b

Result of NOT a

TRUE

TRUE

TRUE

TRUE

FALSE

TRUE

FALSE

FALSE

TRUE

FALSE

TRUE

NULL

NULL

TRUE

FALSE

FALSE

FALSE

FALSE

FALSE

TRUE

FALSE

NULL

FALSE

NULL

TRUE

NULL

NULL

NULL

NULL

NULL

The operators AND and OR are commutative, meaning swapping the left and right operands does not affect the result.