Jaa


is true operator

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime

Tests whether expr is true.

Syntax

expr is [not] true

Arguments

  • expr: A BOOLEAN or STRING expression.

Returns

A BOOLEAN.

If expr is a STRING of case-insensitive value 't', 'true', 'y', 'yes', or '1' it is interpreted as a BOOLEAN true. If the value is 'f', 'false', 'n', 'no', or '0' it is interpreted as a BOOLEAN false.

Any other non-NULL string results in a CAST_INVALID_INPUT error.

If expr is NULL the result is false.

If not is specified this operator returns true if expr is true or NULL and false otherwise.

If not is not specified the operator returns true if expr is false and false otherwise.

Examples

> 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