共用方式為


is distinct 運算元

適用于:核取標示為是 Databricks SQL 檢查標示為是 Databricks Runtime

測試引數是否有不同的值,其中 NUL 視為可比較的值。

語法

expr1 is [not] distinct from expr2

參數

  • expr1:可比較類型的運算式。
  • expr2:與 共用 最不通用型 別之型 expr1 別的運算式。

返回

布林值。

如果 兩者皆 expr1expr2 為 Null,則視為不相異。

如果 只有其中一個 expr1expr2 是 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