题解 | #统计每个用户的平均刷题数#
统计每个用户的平均刷题数
https://www.nowcoder.com/practice/f4714f7529404679b7f8909c96299ac4
SELECT us.university, q1.difficult_level, count(q.question_id)/count(distinct q.device_id) as avg_answer_cnt FROM user_profile as us JOIN question_practice_detail as q ON us.device_id=q.device_id JOIN question_detail as q1 ON q1.question_id=q.question_id GROUP BY us.university,q1.difficult_level HAVING us.university='山东大学'
这里有个小卡点就是GTOUP BY那里不要少写个 us.university