is true
Operatore
Si applica a: controllo SQL di Databricks Databricks Runtime
Verifica se expr
è true
.
Sintassi
expr is [not] true
Argomenti
expr
: espressione BOOLEAN o STRING.
Restituisce
VALORE BOOLEAN.
Se expr
è un valore 't'
STRING senza distinzione tra maiuscole e minuscole, , 'true'
, 'y'
'yes'
o '1'
viene interpretato come valore BOOLEANtrue
.
Se il valore è 'f'
, 'false'
, 'n'
'no'
, o '0'
viene interpretato come valore BOOLEANfalse
.
Qualsiasi altra stringa non NULL genera un errore CAST_INVALID_INPUT .
Se expr
è NULL
il risultato è false
.
Se not
viene specificato, l'operatore restituisce true
se expr
è true
o NULL
e in false
caso contrario.
Se not
non viene specificato, l'operatore restituisce true
se expr
è false
e false
in caso contrario.
Esempi
> SELECT true is true;
true
> SELECT 't' is true;
true
> SELECT false is true;
false
> SELECT NULL is true;
false
> SELECT 'valid' is true;
Error: CAST_INVALID_INPUT
> SELECT true is not true;
false
> SELECT 't' is not true;
false
> SELECT false is not true;
true
> SELECT NULL is not true;
true