题解 | #查找入职员工时间排名倒数第三的员工所有信息#

浙大不同难度题目的正确率

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;
	
	

效率不行,写法也不好看,但是能通过题目测试。

全部评论

相关推荐

10-07 23:57
已编辑
电子科技大学 Java
八街九陌:博士?客户端?开发?啊?
点赞 评论 收藏
分享
头像
11-09 17:30
门头沟学院 Java
TYUT太摆金星:我也是,好几个华为的社招找我了
点赞 评论 收藏
分享
1 收藏 评论
分享
牛客网
牛客企业服务