这里主要是用到左连接查询,因为内连接会忽略None,然后排序
select qd.difficult_level,avg(if(qpd.result='right',1,0)) as correct_rate
from user_profile up
left outer join question_practice_detail qpd
on up.device_id=qpd.device_id
left outer join question_detail qd
on qd.question_id=qpd.question_id
where up.university='浙江大学'
group by qd.difficult_level
having qd.difficult_level!='None'
ORDER by correct_rate ASC