EnterpriseDB

Previous PageTable Of ContentsNext Page

3.5.1 Logical Operators

The usual logical operators are available: AND, OR, NOT

SQL uses a three-valued Boolean logic where the null value represents "unknown". Observe the following truth tables:

Table 3-14 AND/OR Truth Table

a

b

a AND b

a OR b

True

True

True

True

True

False

False

True

True

Null

Null

True

False

False

False

False

False

Null

False

Null

Null

Null

Null

Null

Table 3-15 NOT Truth Table

a

NOT a

True

False

False

True

Null

Null

The operators AND and OR are commutative, that is, you can switch the left and right operand without affecting the result.

Previous PageTable Of ContentsNext Page

Powered by Transit