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

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

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
全部评论

相关推荐

01-30 22:03
门头沟学院 Java
用微笑面对困难:我滴妈,【俩月】【实习】【主管】仨debuff吃满了,独立设计开发的项目写了绝大占比的运营板块,你独立开发,那维护、问题复盘、日志更新、bug、策划书全是自己整的? 不建议写那么大,可以从小出发更容易
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务