Logical value expression¶
The logical value expression performs logical operations and returns a result of the boolean type.
Syntax¶
- logical_value_expression
logical_value_expression ::=
value_expression ( 'AND' | 'OR' ) value_expression
Parameters¶
value_expression¶
The value expression on which the logical operation is performed. For more information, see Expressions.
AND | OR¶
The type of logical operation, including AND and OR.
The following sections list the truth tables for AND and OR respectively.
Truth table for the AND Boolean operator¶
| AND | True | False | Unknown |
|---|---|---|---|
| True | true | false | null |
| False | false | false | false |
| Unknown | null | false | null |
Truth table for the OR Boolean operator¶
| OR | True | False | Unknown |
|---|---|---|---|
| True | true | true | true |
| False | true | false | null |
| Unknown | true | null | null |
Examples¶
Use the OR operator¶
RETURN true OR false AS a
Return:
+------+
| a |
+------+
| true |
+------+
Use the AND operator¶
RETURN 1=2 AND 1=1 AS b
Return:
+-------+
| b |
+-------+
| false |
+-------+