Select10ISNULL;+----------------+|10ISNULL|+----------------+|0 |+---------- --+1rowinset(0.00sec)mysql>Select10ISNO"/> Select10ISNULL;+----------------+|10ISNULL|+----------------+|0 |+---------- --+1rowinset(0.00sec)mysql>Select10ISNO">

Home >Database >Mysql Tutorial >What are the benefits of MySQL 'IS NULL' and 'IS NOT NULL'?

What are the benefits of MySQL 'IS NULL' and 'IS NOT NULL'?

王林
王林forward
2023-09-08 12:37:021358browse

MySQL“IS NULL”和“IS NOT NULL”有什么好处?

We know that when using NULL and comparison operators, we will not get any meaningful result set. To get meaningful results from such comparisons, we can use "IS NULL" and "IS NOT NULL".

Example

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

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

The above MySQL statement shows the use of "IS NULL" and "IS NOT NULL". The result we get is a Boolean value of 0 (for FALSE) or 1 (for TRUE), which is of course a meaningful result.

The above is the detailed content of What are the benefits of MySQL 'IS NULL' and 'IS NOT 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