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

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

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

with
    l1 as (
        select
            exam_id,
            tag,
            difficulty
        from
            examination_info
        where
            tag = 'SQL'
            and difficulty = 'hard'
        group by
            exam_id,
            tag,
            difficulty
    ),
    l2 as (
        select
            *
        from
            exam_record
        where
            submit_time is not null
    )

select
    tag,
    difficulty,
    round(avg(score) ,1)as clip_avg_score
from
    (
        select
            tag,
            difficulty,
            score,
            row_number() over (
                partition by
                    tag
                order by
                    score desc
            ) as rank_1,
            row_number() over (
                partition by
                    tag
                order by
                    score asc
            ) as rank_2
        from
            l1 join l2  on l1.exam_id = l2.exam_id
    ) a
where
    rank_1 > 1
    and rank_2 > 1
group by
    tag,
    difficulty

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-03 17:37
点赞 评论 收藏
分享
05-14 20:34
门头沟学院 Java
窝补药贝八股:管他们,乱说,反正又不去,直接说680
点赞 评论 收藏
分享
看到这个内容真是闹麻了。。。。。。现在有了AI以后很多人面试都会作弊吗? 那对老老实实面试的人岂不是不公平....
程序员牛肉:公平那是对小孩子讲的童话故事,成年人的世界只有能不能接受失败的后果。 你要是能接受面试作弊被发现之后多家公司联合永久拉黑的后果,你就搞。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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