题解 | #对试卷得分做min-max归一化#

对试卷得分做min-max归一化

https://www.nowcoder.com/practice/2b7acdc7d1b9435bac377c1dcb3085d6

select uid,exam_id,round(sum(normal_score)/count(normal_score),0) 'avg'
from(select uid,exam_id,if(min_score=max_score,score,(score-min_score)*100/(max_score-min_score)) 'normal_score'
from (select uid,exam_id,submit_time,score,min(score)over(partition by exam_id) 'min_score',max(score)over(partition by exam_id) 'max_score'
from exam_record
where exam_id in 
(
    select exam_id
    from examination_info
    where difficulty = 'hard'
) and submit_time is not null
) t1)t2
group by uid,exam_id
order by exam_id asc,avg desc

全部评论

相关推荐

2024-12-25 09:09
四川师范大学 运营
想和你交朋友的潜伏者要冲国企:先去沃尔玛亲身感受标准化流程体系,一两年后再跳槽国内任何零售行业,可以有更大选择权吧?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务