Why MySQL Cannot Use Arithmetic Operators with NULL



The reason behind it is that we will not receive any meaningful results from the comparisons when we use NULL with the comparison operators like ‘=’, ‘<’ or ‘<>’. Consider the following example which demonstrates this concept −

mysql> Select 10 = NULL, 10< NULL, 10<>NULL;
+-----------+----------+----------+
| 10 = NULL | 10< NULL | 10<>NULL |
+-----------+----------+----------+
|      NULL |     NULL |     NULL |
+-----------+----------+----------+
1 row in set (0.07 sec)

The above result set is not meaningful in any sense.

Updated on: 2020-06-22T11:31:08+05:30

183 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements