这道题,直白地说,就是求每个学校、每一种难度的题目,平均被多少作答过。
题目的平均被作答人数=答题的总次数/独立答题人数=count(qpd.question_id)/count(DISTINCT qpd.device_id)
题目的平均被作答人数=答题的总次数/独立答题人数=count(qpd.question_id)/count(DISTINCT qpd.device_id)
SELECT up.university, qd.difficult_level, count(qpd.question_id)/count(DISTINCT qpd.device_id) as avg_answer_cnt FROM question_practice_detail as qpd JOIN user_profile as up ON up.device_id = qpd.device_id JOIN question_detail as qd ON qpd.question_id = qd.question_id GROUP BY up.university, qd.difficult_level;