DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

9.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:

aba AND ba OR b
TRUETRUETRUETRUE
TRUEFALSEFALSETRUE
TRUENULLNULLTRUE
FALSEFALSEFALSEFALSE
FALSENULLFALSENULL
NULLNULLNULLNULL

aNOT a
TRUEFALSE
FALSETRUE
NULLNULL

The operators AND and OR are commutative, that is, you can switch the left and right operand without affecting the result. But see Section 4.2.12 for more information about the order of evaluation of subexpressions.