题解 | 分组计算练习题
分组计算练习题
https://www.nowcoder.com/practice/009d8067d2df47fea429afe2e7b9de45
select #查字段
u.gender,
u.university,
count(u.device_id) as user_num,
round(avg(u.active_days_within_30),1) as avg_active_day,
round(avg(u.question_cnt),1) as avg_question_cnt
from
user_profile as u
group by # 分组
u.university,
u.gender
order by u.gender,u.university asc; #按升序排列
先确认要查找的字段,和目标表。然后按要求进行排序,asc 为升序,desc 为降序。



查看16道真题和解析