Home >Database >Mysql Tutorial >When MySQL arithmetic expression returns NULL?

When MySQL arithmetic expression returns NULL?

WBOY
WBOYforward
2023-09-11 19:29:021348browse

When MySQL arithmetic expression returns NULL?

We know that NULL is not a value and it is different from zero. MySQL arithmetic expression will return NULL if we use NULL in it. It can be understood through the following example -

Example

mysql> Select 100*NULL;
+----------+
| 100*NULL |
+----------+
|     NULL |
+----------+
1 row in set (0.00 sec)

mysql> Select 100+NULL;
+----------+
| 100+NULL |
+----------+
|     NULL |
+----------+
1 row in set (0.00 sec)

As can be seen from the above example, if we use NULL in an arithmetic expression, then the result itself is NULL .

The above is the detailed content of When MySQL arithmetic expression returns NULL?. 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