How MySQL NULL-safe equal operator performs when used with row comparisons?


When we use NULL-safe operator with row comparisons like (A, B) <=> (C, D) then its performance is equivalent to (A <=> C) AND (B <=> D). Following example will demonstrate it −

mysql> Select (100,50) <=> (50,100);
+-----------------------+
| (100,50) <=> (50,100) |
+-----------------------+
|                     0 |
+-----------------------+
1 row in set (0.00 sec)

mysql> Select (100,50) <=> (100,50);
+-----------------------+
| (100,50) <=> (100,50) |
+-----------------------+
|                     1 |
+-----------------------+
1 row in set (0.00 sec)

The above result sets show how NULL-safe operators can be used with row comparison.

Updated on: 22-Jun-2020

64 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements