Home >Database >Mysql Tutorial >What is the usage of if in mysql

What is the usage of if in mysql

WBOY
WBOYOriginal
2021-12-27 09:59:1933569browse

In mysql, the if() function is used to determine conditions. It returns a value when the condition is true, and returns another value when the condition is false. The syntax is "IF(condition, when the condition is true Return value, the return value when the condition is false)".

What is the usage of if in mysql

The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer

if in mysql What is the usage

#IF() function returns a value when the condition is TRUE and another value if the condition is FALSE.

The syntax is:

IF(condition, value_if_true, value_if_false)

Among them:

What is the usage of if in mysql

##The example is as follows:


SELECT IF(500<1000, "YES", "NO");

Output Result:


What is the usage of if in mysql

Recommended learning:

mysql video tutorial

The above is the detailed content of What is the usage of if in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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