select
difficult_level,
sum(
case
when result = 'right' then 1
else 0
end
) / count(q1.question_id) as correct_rate
from
user_profile u
join question_practice_detail q on q.device_id = u.device_id
join question_detail q1 on q1.question_id = q.question_id
where
u.university = '浙江大学'
group by
difficult_level
order by sum(
case
when result = 'right' then 1
else 0
end
) / count(q1.question_id)
;

京公网安备 11010502036488号