题解 | #SQL类别高难度试卷得分的截断平均值#

SQL类别高难度试卷得分的截断平均值

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

select tag,difficulty,round(sum(score)/count(score),1) clip_avg_score from

(select

uid,exam_id,score,tag,difficulty,

first_value(score) over(order by score desc rows between unbounded preceding and unbounded following) max_value,

last_value(score) over(order by score desc rows between unbounded preceding and unbounded following) min_value

from

(select uid,ei.exam_id exam_id,score,tag,difficulty from exam_record er

left join

examination_info ei

on er.exam_id = ei.exam_id

where

ei.tag = 'SQL'

and ei.difficulty = 'hard'

and score is not null) a) t

where t.score max_value and t.score min_value

group by tag,difficulty

全部评论

相关推荐

10-01 09:50
门头沟学院 Java
肖先生~:这个人真的很好,点赞
点赞 评论 收藏
分享
ResourceUt...:楼主有自己的垃圾箱,公司也有自己的人才库
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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