SELECT qd.difficult_level,(
SUM(CASE WHEN qpd.result='right' THEN 1
ELSE 0
END
)/COUNT(qpd.result)
) correct_rated
FROM user_profile up,
question_practice_detail qpd,
question_detail qd
WHERE up.university='浙江大学'
AND up.device_id=qpd.device_id
AND qpd.question_id=qd.question_id
GROUP BY qd.difficult_level
order by correct_rated asc
SUM(CASE WHEN qpd.result='right' THEN 1
ELSE 0
END
)/COUNT(qpd.result)
) correct_rated
FROM user_profile up,
question_practice_detail qpd,
question_detail qd
WHERE up.university='浙江大学'
AND up.device_id=qpd.device_id
AND qpd.question_id=qd.question_id
GROUP BY qd.difficult_level
order by correct_rated asc