题解 | #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

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

相关推荐

12-24 20:49
武汉大学 Java
点赞 评论 收藏
分享
八极星:有什么不能问的,(/_\),这又不是多珍贵的机会,你有什么可失去的
点赞 评论 收藏
分享
我要娶个什么名:学长你电脑闹鬼了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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