]> begriffs open source - ai-pg/blob - full-docs/txt/functions-logical.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / functions-logical.txt
1
2 9.1. Logical Operators #
3
4    The usual logical operators are available:
5 boolean AND boolean → boolean
6 boolean OR boolean → boolean
7 NOT boolean → boolean
8
9    SQL uses a three-valued logic system with true, false, and null, which
10    represents “unknown”. Observe the following truth tables:
11      a     b   a AND b a OR b
12    TRUE  TRUE  TRUE    TRUE
13    TRUE  FALSE FALSE   TRUE
14    TRUE  NULL  NULL    TRUE
15    FALSE FALSE FALSE   FALSE
16    FALSE NULL  FALSE   NULL
17    NULL  NULL  NULL    NULL
18
19      a   NOT a
20    TRUE  FALSE
21    FALSE TRUE
22    NULL  NULL
23
24    The operators AND and OR are commutative, that is, you can switch the
25    left and right operands without affecting the result. (However, it is
26    not guaranteed that the left operand is evaluated before the right
27    operand. See Section 4.2.14 for more information about the order of
28    evaluation of subexpressions.)