select
up.university,
qd.difficult_level,
(count(qpd.question_id)/count(distinct qpd.device_id)) avg_answer_cnt
from user_profile up
join question_practice_detail qpd
on up.device_id = qpd.device_id
join question_detail qd
on qpd.question_id = qd.question_id
group by up.university,qd.difficult_level
having up.university='山东大学'