Home > Database > Mysql Tutorial > body text

What is the usage of if in mysql

WBOY
Release: 2021-12-27 09:59:19
Original
33452 people have browsed it

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

Among them:

What is the usage of if in mysql

##The example is as follows:


SELECT IF(500<1000, "YES", "NO");
Copy after login
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!

Related labels:
source:php.cn
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!