题解 | 分组计算练习题
#现在运营想要对每个学校不同性别的用户活跃情况和发帖数量进行分析, #请分别计算出每个学校每种性别的用户数、30天内平均活跃天数和平均发帖数量。 SELECT gender,university, count(device_id) as user_num, round(avg(active_days_within_30),1) as avg_active_day, round(avg(question_cnt),1) as avg_question_cnt FROM user_profile GROUP BY university,gender ORDER BY gender,university