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'?

王林
Release: 2023-09-08 12:37:02
forward
1364 people have browsed it

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)
Copy after login

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!

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