题解 | #浙大不同难度题目的正确率#
浙大不同难度题目的正确率
http://www.nowcoder.com/practice/d8a4f7b1ded04948b5435a45f03ead8c
问题分解: 1.浙江大学的用户 university='浙江大学' 2.不同难度 group by difficult_level 3.正确率顺序排序 order by correct_rate 4.正确率 sum(if(result='right',1,0) / count(question_id) as correct_rate
select
difficult_level,sum(if(result='right',1,0)) / count(d.question_id) as correct_rate
from
question_practice_detail p
join
user_profile u
ON
p.device_id = u.device_id
join
question_detail d
on
p.question_id = d.question_id
where
university='浙江大学'
group by
difficult_level
order by
correct_rate