Home  >  Article  >  Database  >  How does MySQL evaluate an expression if the parameters in NULLIF() are not equal?

How does MySQL evaluate an expression if the parameters in NULLIF() are not equal?

WBOY
WBOYforward
2023-09-01 16:09:11681browse

如果 NULLIF() 中的参数不相等,MySQL 如何计算表达式?

We know that the MySQL NULLIF() control flow function will return the first parameter, and the two parameters are not the same. Returns the first argument because MySQL evaluates the first argument twice if the two arguments are not the same.

Example

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

In the above example, since the parameters are not the same, MySQL evaluates the first parameter, i.e. "Tutorialspoint", twice and returns it as output.

The above is the detailed content of How does MySQL evaluate an expression if the parameters in NULLIF() are not equal?. 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