<=>

Overview

Equality without special treatment for NULL.

USAGE

value1 <=> value2

Value Name

Description

value

The two values to compare

DETAILS

The <=> operator compares two values, returning 1 (true) if both values are equivalent, otherwise 0.

If at least one value is a number, a numeric comparison is performed. Thus, a string value is converted into a number when paired with a numeric value.

When both values are strings, the comparison takes into account the current sort order, which might treat uppercase and lowercase letters as equivalent.

A NULL value is not treated specially, so it compares equal to another NULL and unequal to everything else.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SELECT 42 <=> 42, 1 <=> 0, NULL <=> NULL;
+-----------+---------+---------------+
| 42 <=> 42 | 1 <=> 0 | NULL <=> NULL |
+-----------+---------+---------------+
|         1 |       0 |             1 |
+-----------+---------+---------------+
SELECT 99 <=> 123,
       PI() <=> 3.141592653589793 AS pi_eq;
+------------+-------+
| 99 <=> 123 | pi_eq |
+------------+-------+
|          0 |     1 |
+------------+-------+
-- Disable strict mode or the comparison might throw an error
SET sql_mode = '';
SELECT 99 <=> '99a', 'abc' <=> 0;
+--------------+-------------+
| 99 <=> '99a' | 'abc' <=> 0 |
+--------------+-------------+
|            1 |           1 |
+--------------+-------------+

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES