题解 | #浙大不同难度题目的正确率#
浙大不同难度题目的正确率
http://www.nowcoder.com/practice/d8a4f7b1ded04948b5435a45f03ead8c
这里主要是用到左连接查询,因为内连接会忽略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