is distinct
算子
適用於:Databricks SQL
Databricks Runtime
測試自變數是否有不同的值,其中 NUL 被視為可比較的值。
語法
expr1 is [not] distinct from expr2
引數
傳回
布爾值。
如果 expr1
和 expr2
都是 NULL,則會被視為不相異。
如果 只有其中 expr1
一個 且 expr2
為 NULL,則表示式會視為相異。
如果 和 expr1
expr2
都不是 NULL,則會在 時expr
<>expr2
視為相異。
範例
> SELECT NULL is distinct from NULL;
false
> SELECT NULL is distinct from 5;
true
> SELECT 1 is distinct from 5;
true
> SELECT NULL is not distinct from 5;
false