SELECT
up.university university,
qd.difficult_level difficult_level,
COUNT(up.device_id)/COUNT(DISTINCT up.device_id) avg_answer_cnt --经过大学+设备id分组后,得到组下的所有已回答设备,求平均每个设备的回答数
FROM
user_profile up
INNER JOIN
question_practice_detail qpd using(device_id)
INNER JOIN
question_detail qd using(question_id)
GROUP BY up.university,qd.difficult_level;