题解 | #对试卷得分做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

全部评论

相关推荐

11-06 16:50
门头沟学院 Java
用微笑面对困难:word打字比赛二等奖的我,也要来凑合凑合
点赞 评论 收藏
分享
看起来名字可以很长:笑死 我暑期实习阿里云的意向也被 qq 邮箱放在垃圾箱了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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