题解 | #统计每个用户的平均刷题数#

统计每个用户的平均刷题数

http://www.nowcoder.com/practice/f4714f7529404679b7f8909c96299ac4

使用内连接

SELECT university,difficult_level,round((count(qpd.result)/count(DISTINCT qpd.device_id)),4) as avg_answer_cnt
FROM user_profile as u
INNER JOIN question_practice_detail as qpd
ON u.device_id = qpd.device_id
INNER JOIN question_detail as qd
ON qpd.question_id = qd.question_id
WHERE university = "山东大学"
GROUP BY difficult_level
全部评论

相关推荐

评论
2
收藏
分享
牛客网
牛客企业服务