Home > Database > Mysql Tutorial > body text

What is the use of the MySQL NULLIF() control flow function?

PHPz
Release: 2023-09-12 12:13:02
forward
1200 people have browsed it

MySQL NULLIF()控制流函数有什么用?

The MySQL NULLIF() control flow function will return NULL if the two parameters are the same, otherwise it will return the first parameter.

Syntax

NULLIF(expression1, expression2)
Copy after login

Here, if expression1 = expression2, NULLIF() will return NULL, otherwise it will return expression1. The following example will demonstrate this -

mysql> Select NULLIF('Ram','Ram');
+---------------------+
| NULLIF('Ram','Ram') |
+---------------------+
| NULL                |
+---------------------+
1 row in set (0.00 sec)

mysql> Select NULLIF('Ram','Shyam');
+-----------------------+
| NULLIF('Ram','Shyam') |
+-----------------------+
| Ram                   |
+-----------------------+
1 row in set (0.00 sec)
Copy after login

The above is the detailed content of What is the use of the MySQL NULLIF() control flow function?. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!