Logical Operators
- reference
|
Couchbase Server Enterprise Edition 7.6 reaches End of Life on March 31, 2027. Please upgrade to 8.0.x by following Upgrade, or contact Couchbase Support. |
Logical terms let you combine other expressions using Boolean logic. SQL++ provides the following logical operators:
-
AND
-
OR
-
NOT
In SQL++, logical operators have their usual meaning; however, Boolean propositions can evaluate to NULL or MISSING as well as to TRUE and FALSE. The truth tables for these operators therefore use four-valued logic.
AND
and ::= cond 'AND' cond
AND evaluates to TRUE only if both conditions are TRUE.
| TRUE | FALSE | NULL | MISSING | |
|---|---|---|---|---|
TRUE |
TRUE |
FALSE |
NULL |
MISSING |
FALSE |
FALSE |
FALSE |
FALSE |
FALSE |
NULL |
NULL |
FALSE |
NULL |
MISSING |
MISSING |
MISSING |
FALSE |
MISSING |
MISSING |
OR
or ::= cond 'OR' cond
OR evaluates to TRUE if one of the conditions is TRUE.
| TRUE | FALSE | NULL | MISSING | |
|---|---|---|---|---|
TRUE |
TRUE |
TRUE |
TRUE |
TRUE |
FALSE |
TRUE |
FALSE |
NULL |
MISSING |
NULL |
TRUE |
NULL |
NULL |
NULL |
MISSING |
TRUE |
MISSING |
NULL |
MISSING |
NOT
not ::= 'NOT' cond
NOT evaluates to TRUE if the condition is FALSE, and vice versa.
| NOT | |
|---|---|
TRUE |
FALSE |
FALSE |
TRUE |
NULL |
NULL |
MISSING |
MISSING |
Related Links
For further details, refer to Boolean Logic.