<=> (lt eq gt sign) operator (Databricks SQL)

Returns the same result as the EQUAL(=) for non-null operands, but returns true if both are NULL, false if one of the them is NULL.

Syntax

expr1 <=> expr2

Arguments

  • expr1: An expression of a comparable type.

  • expr2: An expression that shares a least common type with expr1.

Returns

A BOOLEAN.

This operator is a synonym for expr1 is not distinct from expr2

Examples

> SELECT 2 <=> 2;
 true
> SELECT 1 <=> '1';
 true
> SELECT true <=> NULL;
 false
> SELECT NULL <=> NULL;
 true