题解 | #查找入职员工时间排名倒数第三的员工所有信息#
浙大不同难度题目的正确率
http://www.nowcoder.com/practice/d8a4f7b1ded04948b5435a45f03ead8c
SELECT
tmp1.difficult_level,
IFNULL(( right_num / num ),0) AS correct_rate
FROM
(
SELECT
det.difficult_level,
count( 1 ) AS num
FROM
`user_profile` pro
LEFT JOIN question_practice_detail pra ON pro.device_id = pra.device_id
LEFT JOIN question_detail det ON pra.question_id = det.question_id
WHERE
university = '浙江大学'
GROUP BY
difficult_level
) tmp1
LEFT JOIN (
SELECT
det.difficult_level,
count( 1 ) AS right_num
FROM
`user_profile` pro
LEFT JOIN question_practice_detail pra ON pro.device_id = pra.device_id
LEFT JOIN question_detail det ON pra.question_id = det.question_id
WHERE
university = '浙江大学'
AND result = 'right'
GROUP BY
difficult_level
) tmp2 ON tmp1.difficult_level = tmp2.difficult_level where tmp1.difficult_level > ""
ORDER BY
correct_rate ASC;
效率不行,写法也不好看,但是能通过题目测试。