ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## 条件判断 ### if,else ```sql SELECT id, baby_sex, IF (baby_sex = 0, '女', '男') AS baby_sex_format FROM baby; ``` ### case,when ``` SELECT id, baby_sex, ( CASE WHEN baby_sex = 0 THEN '女' WHEN baby_sex = 1 THEN '男' ELSE '未知' END ) AS baby_sex_format FROM baby; ``` ``` SELECT id, baby_sex, ( CASE baby_sex WHEN 0 THEN '女' WHEN 1 THEN '男' ELSE '未知' END ) AS baby_sex_format FROM baby; ```