题解 | #查看不同年龄段的用户明细#
查看不同年龄段的用户明细
https://www.nowcoder.com/practice/ae44b2b78525417b8b2fc2075b557592
SELECT u.device_id, u.gender, CASE WHEN age < 20 THEN '20岁以下' WHEN age BETWEEN 20 AND 24 THEN '20-24岁' WHEN age >= 25 THEN '25岁及以上' WHEN age is NULL THEN '其他' END AS age_cut FROM user_profile AS u;
多条件函数CASE的使用