题解 | #计算25岁以上和以下的用户数量#
计算25岁以上和以下的用户数量
https://www.nowcoder.com/practice/30f9f470390a4a8a8dd3b8e1f8c7a9fa
select ( case when b.rangeAge = 1 then '25岁以下' else '25岁及以上' end ) as age_cut, count(1) as number from ( select ( case when a.age is null then 1 when a.age < 25 then 1 else 0 end ) as rangeAge from user_profile a ) b group by b.rangeAge
这样写虽然很蠢,但能联系练习练习case when