Home >Database >Mysql Tutorial >Why can't we use arithmetic operators like '=', '' etc. with NULL in MySQL?

Why can't we use arithmetic operators like '=', '' etc. with NULL in MySQL?

王林
王林forward
2023-08-27 08:49:02954browse

为什么在 MySQL 中,我们不能将‘=’、‘’等算术运算符与 NULL 一起使用?

The reason behind this is that when we use NULL with comparison operators like "=", "" etc., we do not receive anything from the comparison to any meaningful results. Consider the following example to demonstrate 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 does not make sense in any sense.

The above is the detailed content of Why can't we use arithmetic operators like '=', '' etc. with NULL in MySQL?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete