题解 | #查找除复旦大学的用户信息#

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

http://www.nowcoder.com/practice/d8a4f7b1ded04948b5435a45f03ead8c

代码1:

select
c.difficult_level,
count(if(result='right',a.question_id,null)) / count(a.question_id) as correct_rate
from

(select device_id,question_id,result
from question_practice_detail
)a

join

(select device_id
from user_profile
where university = '浙江大学'
)b
on a.device_id = b.device_id


left join
(
select
question_id,difficult_level
from question_detail
)c

on a.question_id = c.question_id
group by difficult_level
order by correct_rate

代码2:

select difficult_level,
(count(case when result='right' then 1 else null end)/count(*)) as correct_rate
from user_profile 

up left join 
question_practice_detail qpd on up.device_id=qpd.device_id

left join
question_detail qd on qpd.question_id=qd.question_id

where university='浙江大学'
group by difficult_level
having difficult_level!='None'
//输出结果不能由none
order by correct_rate
全部评论

相关推荐

2024-12-21 18:48
西安邮电大学 C++
黑皮白袜臭脚体育生:按使用了什么技术解决了什么问题,优化了什么性能指标来写会更好另外宣传下自己的开源仿b站微服务项目,GitHub已经390star,牛客上有完整文档教程
点赞 评论 收藏
分享
明天不下雨了:兄弟你是我今天看到的最好看的简历(我说的是简历风格跟简历书写)把985 211再搞亮一点。投boss就说;您好,我华科(985)研二在读,本科211。对您的岗位很感兴趣,希望能获得一次投递机会。
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务