Condividi tramite


== Operatore (eq eq sign)

Si applica a:segno di spunta sì Databricks SQL segno di spunta sì Databricks Runtime

Restituisce true se expr1 è uguale a expr2 o false in caso contrario. Questa funzione è un sinonimo di operatore = (eq sign). Usare equal_null per considerare NULL come un valore paragonabile.

Sintassi

expr1 == expr2

Argomenti

  • expr1: espressione di qualsiasi tipo paragonabile.
  • expr2: espressione che condivide un tipo meno comune con expr1.

Valori restituiti

Oggetto BOOLEAN.

Esempi

> SELECT 2 == 2;
 true

> SELECT 1 == '1';
 true

> SELECT true == NULL;
 NULL

> SELECT NULL == NULL;
 NULL

-- By default string comparisons are trailing blank sensitive
-- This can be overridden by using the COLLATE clause
> SELECT 'hello' == 'hello  ' AS default,
         'hello' == 'hello  ' COLLATE UTF8_BINARY AS utf8_binary,
         'hello' == 'hello  ' COLLATE UTF8_BINARY_RTRIM AS rtrim;
 default utf8_binary rtrim
 ------- ----------- -----
 false   false       true

 -- By default string comparisons are trailing space sensitive
-- This can be overridden by using the COLLATE clause
> SELECT 'world  ' == 'world     ' AS default,
         'world  ' == 'world     ' COLLATE UTF8_BINARY AS utf8_binary,
         'world  ' == 'world     ' COLLATE UTF8_BINARY_RTRIM AS rtrim;
 default utf8_binary rtrim
 ------- ----------- -----
 false   false       true