- 类别:
[ NOT ] EQUAL_NULL¶
比较两个表达式是否相等。该函数为 NULL-safe,意味着它将 NULLs 视作用于比较相等性的已知值。请注意,这与 EQUAL 比较运算符 (=) 不同,后者将 NULLs 视为未知值。
- 另请参阅:
语法¶
使用说明¶
返回的值取决于是否有输入为 NULL 值:
- 返回 TRUE:
EQUAL_NULL( <null> , <null> )- 返回 FALSE:
EQUAL_NULL( <null> , <not_null> )EQUAL_NULL( <not_null> , <null> )
否则:
EQUAL_NULL( <expr1>, <expr2>)等效于<expr1> = <expr2>
有关详细信息,请参阅以下示例。
排序规则详细信息¶
The collation specifications of all input arguments must be compatible.
The comparisons follow the collation based on the input arguments' collations and precedences.
示例¶
创建一个包含简单数据的表:
展示通过将表联接到自身而生成的笛卡尔积,而不使用筛选器:
返回仅包含两列中相等值的行:
返回仅包含两列中相等值或 NULL 值的行:
展示 EQUAL (=) 和 NOT EQUAL (`` <>``) 的所有可能结果:
Illustrate all possible outcomes for EQUAL_NULL and NOT EQUAL_NULL: