MySQL IF Function

Example

Return “YES” if the condition is TRUE, or “NO” if the condition is FALSE:

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

Definition and Usage

The IF() function returns a value if a condition is TRUE, or another value if a condition is FALSE.

Syntax

IF(condition, value_if_true, value_if_false)

Continue reading MySQL IF Function