Compartilhar via


operador = (sinal de igual)

Aplica-se a:marca de seleção positiva SQL do Databricks marca de seleção positiva Runtime do Databricks

Retorna true se expr1 é igual a expr2, caso contrário, false. Essa função é sinônimo do operador == (sinal de igual duplo).

Sintaxe

expr1 = expr2

Argumentos

  • expr1: uma expressão de qualquer tipo comparável.
  • expr2: uma expressão que compartilha um tipo menos comum com expr1.

Retornos

Um BOOLEAN.

Exemplos

> SELECT 2 = 2;
 true

> SELECT 1 = '1';
 true

> SELECT true = NULL;
 NULL

> SELECT equal_null(true, NULL);
 false

> SELECT NULL = NULL;
 NULL

> SELECT equal_null(NULL, NULL);
 true

-- By default string comparisons are trailing space 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