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

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

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

逻辑很简单,就是先用聚合加窗口函数算出归一值,然后再取平均值。

select uid, exam_id, cast(avg(standard) as unsigned) as avg_new_score from

(select uid, exam_id, 
if(count(score) over (partition by exam_id) = 1, score, 
   100*(score - min(score) over (partition by exam_id))/ (max(score) over (partition by exam_id) - min(score) over (partition by exam_id))) as standard
from examination_info inner join exam_record using(exam_id)
where difficulty = "hard" and score is not null) as temp

group by uid, exam_id
order by exam_id, avg_new_score desc
全部评论
点赞 回复 分享
发布于 2022-12-08 08:11 四川

相关推荐

07-16 14:10
门头沟学院 Java
点赞 评论 收藏
分享
06-12 17:46
门头沟学院 Java
运营你豪哥:来说重点: ​1.项目前置,时间倒序。​​ 2.​项目描述强化结果与量化效果(STAR原则里的R)。​​ ​3.个人技能精炼,明确掌握程度,突出核心。​​ ​4.增加强有力开头的个人总结部分。​​ 5.​优化教育背景(成绩排名)、合并奖项与活动。​​
听劝,我这个简历该怎么改...
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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