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

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

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


SELECT
t.tag,
t.difficulty,
round(
avg(t.score),1)
from (
select
e2.tag,
e2.difficulty,
e1.score,
dense_rank()over(order by e1.score desc) as m ,
dense_rank()over(order by e1.score asc) as d
from exam_record e1 left join examination_info e2 on e1.exam_id=e2.exam_id
WHERE
e2.tag="SQL"
and
e2.difficulty='hard'
and 
e1.submit_time is not null
    ) as t
    WHERE
    t.m!=1 and t.d!=1

开窗写法,请大佬多多指点。
全部评论

相关推荐

牛马人的牛马人生:500一天吗?香麻了
投递字节跳动等公司9个岗位
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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