---
title: <=> (lt eq gt sign) operator
description: Learn the syntax of the \<=> (lt eq gt sign) operator of the SQL language in Databricks SQL.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/lteqgtsign
---

# `<=>` (lt eq gt sign) operator

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime

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`. This operator is a synonym for `expr1 is not distinct from expr2`.

## Syntax

```
expr1 <=> expr2
```

## Arguments

* `expr1`: An expression of a comparable type.
* `expr2`: An expression that shares a [least common type](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-datatype-rules.md#least-common-type-resolution) with `expr1`.

## Returns

A BOOLEAN.

## Examples

```sql
> SELECT 2 <=> 2;
 true
> SELECT 1 <=> '1';
 true
> SELECT true <=> NULL;
 false
> SELECT 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

 -- String comparisons are trailing space sensitive by default
-- Use the COLLATE clause to override the default
> 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
```

## Related

* [`!=` (bangeq sign) operator](https://docs.databricks.com/aws/en/sql/language-manual/functions/bangeqsign.md)
* [`<` (lt sign) operator](https://docs.databricks.com/aws/en/sql/language-manual/functions/ltsign.md)
* [`>` (gt sign) operator](https://docs.databricks.com/aws/en/sql/language-manual/functions/gtsign.md)
* [`>=` (gt eq sign) operator](https://docs.databricks.com/aws/en/sql/language-manual/functions/gteqsign.md)
* [`<=` (lt eq sign) operator](https://docs.databricks.com/aws/en/sql/language-manual/functions/lteqsign.md)
* [`=` (eq sign) operator](https://docs.databricks.com/aws/en/sql/language-manual/functions/eqsign.md)
* [`<>` (lt gt sign) operator](https://docs.databricks.com/aws/en/sql/language-manual/functions/ltgtsign.md)
* [`is distinct` operator](https://docs.databricks.com/aws/en/sql/language-manual/functions/isdistinct.md)
* [SQL data type rules](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-datatype-rules.md)
* [Collation](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-collation.md)
