Home > Database > Mysql Tutorial > A brief discussion on the details of whether mysql has functions similar to oracle's nvl

A brief discussion on the details of whether mysql has functions similar to oracle's nvl

黄舟
Release: 2017-03-06 13:39:12
Original
1347 people have browsed it

The following editor will bring you a brief discussion on whether mysql has functions similar to oracle's nvl. The editor thinks it is quite good, so I will share it with you now and give it as a reference for everyone. Let’s follow the editor and take a look.

Use ifnull instead of isnull

isnull is to determine whether it is null. The return value is 1 for null or 0 for not empty

ifnull is equivalent to Oracle's nvl, the usage is as follows

mysql> select ifnull(1,10);
+--------------+
| ifnull(1,10) |
+--------------+
|            1 |
+--------------+
1 row in set (0.00 sec)
mysql> select ifnull(null,10);
+-----------------+
| ifnull(null,10) |
+-----------------+
|              10 |
+-----------------+
1 row in set (0.00 sec)
Copy after login


isnull is used as follows

mysql> select isnull(null);
+--------------+
| isnull(null) |
+--------------+
|            1 |
+--------------+
1 row in set (0.00 sec)
mysql> select isnull(1);
+-----------+
| isnull(1) |
+-----------+
|         0 |
+-----------+
1 row in set (0.00 sec)
Copy after login

The above is a brief discussion of the details of whether mysql can have functions similar to Oracle's nvl. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Related labels:
source:php.cn
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