# 9.1.逻辑运算符
boolean AND boolean → boolean
boolean OR boolean → boolean
NOT boolean → boolean
SQL使用真、假和假三值逻辑系统无效的
,表示“未知”。观察以下真值表:
A. | b | A. 和b | A. 或b |
---|---|---|---|
符合事实的 | 符合事实的 | 符合事实的 | 符合事实的 |
符合事实的 | 错误的 | 错误的 | 符合事实的 |
符合事实的 | 无效的 | 无效的 | 符合事实的 |
错误的 | 错误的 | FALSE | FALSE |
FALSE | NULL | FALSE | NULL |
NULL | NULL | NULL | NULL |
a | NOT*a * |
---|---|
TRUE | FALSE |
FALSE | TRUE |
NULL | NULL |
The operatorsAND
andOR
are commutative, that is, you can switch the left and right operands without affecting the result. (However, it is not guaranteed that the left operand is evaluated before the right operand. SeeSection 4.2.14for more information about the order of evaluation of subexpressions.)