if
description
Syntax
if(boolean condition, type valueTrue, type valueFalseOrNull)
如果表达式 condition 成立,返回结果 valueTrue;否则,返回结果 valueFalseOrNull 返回类型: valueTrue 表达式结果的类型
example
1. mysql> select user_id, if(user_id = 1, "true", "false") test_if from test;
2. +---------+---------+
3. | user_id | test_if |
4. +---------+---------+
5. | 1 | true |
6. | 2 | false |
7. +---------+---------+
keywords
IF
