if
Description
Syntax:
if(boolean condition, type valueTrue, type valueFalseOrNull)
If the condition
is true, this function will return valueTrue
; otherwise, it will return valueFalseOrNull
.
Example
mysql> select user_id, if(user_id = 1, "true", "false") test_if from test;
+---------+---------+
| user_id | test_if |
+---------+---------+
| 1 | true |
| 2 | false |
+---------+---------+
Keywords
IF