题解 | #统计每个用户的平均刷题数#
统计每个用户的平均刷题数
https://www.nowcoder.com/practice/f4714f7529404679b7f8909c96299ac4
SELECT u.university, qd.difficult_level, COUNT(qp.question_id)/COUNT(DISTINCT qp.device_id) AS avg_answer_cnt FROM user_profile u JOIN question_practice_detail qp USING(device_id) JOIN question_detail qd USING(question_id) GROUP BY u.university, qd.difficult_level HAVING u.university='山东大学'