题解 | #浙大不同难度题目的正确率#
浙大不同难度题目的正确率
https://www.nowcoder.com/practice/d8a4f7b1ded04948b5435a45f03ead8c
# 现在运营想要了解浙江大学的用户在不同难度题目下答题的正确率情况,请取出相应数据,并按照准确率升序输出。
with t1 as
(select
qpl.device_id,
qpl.question_id,
university,
result,
difficult_level
from question_practice_detail qpl
left join question_detail using(question_id)
left join user_profile using(device_id))
select
difficult_level,
avg(if(result='right', 1, 0)) as correct_rate
from t1
where university = '浙江大学'
group by difficult_level
order by correct_rate
