三表连接,注意的是,最后是 question_id 总数量/device_id总数量,也就是用户数,而不是answer_cnt总数量/总用户数
select c.university
,d.difficult_level
,count(c.question_id)/COUNT(DISTINCT c.device_id)
from
(select a.*
,b.university
,b.answer_cnt
FROM question_practice_detail as a
inner join user_profile as b
on a.device_id=b.device_id) c
inner join question_detail as d
on c.question_id=d.question_id
group by c.university,d.difficult_level