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

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

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

select difficult_level,
    avg(if(qpd.result='right', 1, 0)) as correct_rate
    #sum(if(qpd.result='right', 1, 0)) / count(qpd.question_id) as correct_rate
    #count(if(qpd.result='right', 1, null)) / count(qpd.question_id) as correct_rate
from user_profile as up

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

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

where university='浙江大学'
group by difficult_level
#这样group by difficult_level having university='浙江大学'的话会编译错误出错,应当用下面的:
#group by university,difficult_level having university="浙江大学"
order by correct_rate

全部评论

相关推荐

废铁汽车人:秋招真是牛鬼蛇神齐聚一堂
点赞 评论 收藏
分享
勇敢的联想人前程似锦:如果我是你,身体素质好我会去参军,然后走士兵计划考研211只需要200多分。
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务