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

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

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

select
    tag tag,
    difficulty difficulty,
    round(avg(score), 1) clip_avg_score
from
    (
        select
            tag,
            difficulty,
            score,
            row_number() over (
                order by
                    score asc
            ) as rk_asc,
            row_number() over (
                order by
                    score desc
            ) as rk_desc
        from
            exam_record er
            join examination_info ei on ei.exam_id = er.exam_id
        where
            ei.tag = 'SQL'
            and ei.difficulty = 'hard'
            and er.score is not null
    ) t1
where
    rk_asc <> 1
    and rk_desc <> 1
group by
    tag,
    difficulty

全部评论

相关推荐

迟缓的斜杠青年巴比Q了:简历被投过的公司卖出去了,我前两天遇到过更离谱的,打电话来问我有没有意向报班学Java学习,服了,还拿我学校一个学长在他们那报班学了之后干了华为OD当招牌
点赞 评论 收藏
分享
06-04 17:59
已编辑
长江大学 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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