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?

王林
Release: 2023-08-27 08:49:02
forward
916 people have browsed it

为什么在 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)
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template