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

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

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

select 
uid,exam_id,
-- case when round(sum(guiyi)/count(case when guiyi<>0 then guiyi else null end),0) is not null 
-- then round(sum(guiyi)/count(case when guiyi<>'0' then guiyi else null end),0)
-- else 0 end as avg_new_score
round(avg(guiyi),0) avg_new_score
from(
	select 
	uid,exam_id,
	case when cnt<>1 then (score-min_score)/(max_score-min_score)*100 
	else score end as guiyi
	-- case when format((score-min_score)/(max_score-min_score)*score,0)<>0 then format((score-min_score)/(max_score-min_score)*score,0) else score end avg_new_score
	from (
		select 
		a.uid,a.exam_id,a.score,
		min(score) over (partition by exam_id) min_score,
		max(score) over (partition by exam_id) max_score,
		count(score) over (partition by exam_id) cnt
		from exam_record a left join examination_info b
		on a.exam_id =b.exam_id 
		where b.difficulty='hard'
		and score is not null
		-- order by exam_id,uid
	) d
	-- order by exam_id,uid
	-- where (score-min_score)/(max_score-min_score)*score<>0
)e
group by uid,exam_id
order by exam_id asc,avg_new_score desc

全部评论

相关推荐

03-01 19:30
已编辑
南京大学 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
正在热议
更多
# 长得好看会提高面试通过率吗? #
3136次浏览 43人参与
# HR最不可信的一句话是__ #
1014次浏览 32人参与
# 巨人网络春招 #
11484次浏览 224人参与
# 春招至今,你的战绩如何? #
14766次浏览 137人参与
# AI面会问哪些问题? #
890次浏览 22人参与
# 你的实习产出是真实的还是包装的? #
2704次浏览 52人参与
# MiniMax求职进展汇总 #
24887次浏览 321人参与
# 沪漂/北漂你觉得哪个更苦? #
1209次浏览 38人参与
# 你做过最难的笔试是哪家公司 #
1123次浏览 20人参与
# AI时代,哪个岗位还有“活路” #
2675次浏览 49人参与
# XX请雇我工作 #
51147次浏览 171人参与
# 军工所铁饭碗 vs 互联网高薪资,你会选谁 #
7965次浏览 43人参与
# 简历第一个项目做什么 #
32067次浏览 357人参与
# 简历中的项目经历要怎么写? #
310896次浏览 4257人参与
# 不考虑薪资和职业,你最想做什么工作呢? #
152823次浏览 888人参与
# 当下环境,你会继续卷互联网,还是看其他行业机会 #
187553次浏览 1123人参与
# AI时代,哪些岗位最容易被淘汰 #
64539次浏览 864人参与
# 如果重来一次你还会读研吗 #
229971次浏览 2011人参与
# 投格力的你,拿到offer了吗? #
178239次浏览 891人参与
# 你怎么看待AI面试 #
180643次浏览 1295人参与
# 正在春招的你,也参与了去年秋招吗? #
364158次浏览 2641人参与
# 腾讯音乐求职进展汇总 #
160820次浏览 1114人参与
牛客网
牛客网在线编程
牛客网题解
牛客企业服务