is true operator (Databricks SQL)

Tests whether expr is true.

Syntax

expr is [not] true

Arguments

  • expr: A BOOLEAN, STRING, or numeric expression.

Returns

A BOOLEAN.

If expr is a STRING of case insensitive value 't' or 'true' it is interpreted as a BOOLEAN true. Any other non NULL string is interpreted as false.

If expr is a numeric of value 1 is its interpreted as a BOOLEAN true. Any other non NULL number is interpreted as 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 5 is false;
 true

> SELECT NULL is not false;
 true

> SELECT 'true' is not false;
 true

> SELECT true is not false;
 true