题目描述
https://www.nowcoder.com/practice/30f9f470390a4a8a8dd3b8e1f8c7a9fa
思路:
先使用if条件语句判断age归类到25岁以上和25岁以下,根据age分组,再计算人数
select if(age>=25,'25岁及以上','25岁以下') as age_cut,count(device_id) as number
from user_profile
group by age_cut
题目描述
https://www.nowcoder.com/practice/30f9f470390a4a8a8dd3b8e1f8c7a9fa
思路:
先使用if条件语句判断age归类到25岁以上和25岁以下,根据age分组,再计算人数
select if(age>=25,'25岁及以上','25岁以下') as age_cut,count(device_id) as number
from user_profile
group by age_cut