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

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

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

运营想要了解浙江大学的用户在不同难度题目下答题的正确率情况,请取出相应数据,并按照准确率升序输出。

  1. 浙江大学用户 可以得出where university = '浙江
  2. 在不同难度题目下,可以知道需要按照题目难度分组查询,且需要连接查询
  3. 分组查询 group by question_detail.difficult_level
  4. 连接查询 from user_profile user

right join question_practice_detail qus on user.device_id = qus.device_id

left join question_detail dif on qus.question_id = dif.question_id

  1. 正确率result为right/总数
  2. 按照准确率升序输出,最后order by准确率 asc(可写可不写)
select 
dif.difficult_level,
sum(if(qus.result = 'right',1,0))/count(*) as correct_rate
from user_profile user
right join question_practice_detail qus 
on user.device_id = qus.device_id
left join question_detail dif 
on qus.question_id = dif.question_id
where user.university = '浙江大学' 
group by dif.difficult_level
order by correct_rate asc;

全部评论

相关推荐

04-28 11:34
西北大学 运营
牛客4396号:不好意思,这个照片猛一看像丁真
点赞 评论 收藏
分享
评论
1
1
分享

创作者周榜

更多
牛客网
牛客企业服务