题解 | #SQL类别高难度试卷得分的截断平均值#
SQL类别高难度试卷得分的截断平均值
https://www.nowcoder.com/practice/a690f76a718242fd80757115d305be45
排除“一个”最大最小值,想到row_number窗口函数+子查询; 成功代码如下:(完全感觉做复杂了。。稍等看下大家怎么写的) with x as( select tag,difficulty,score,row_number() over(order by score desc ) r from( select score,tag,difficulty from exam_record a left join examination_info b on a.exam_id = b.exam_id where tag = "SQL" and difficulty = "hard" and score is not null )c ) select tag,difficulty,round(avg(score),1) as clip_avg_score from x where r != (select max(r) from x) and r != (select min(r) from x) group by tag,difficulty#你觉得今年春招回暖了吗#