## 条件判断
### 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;
```