题解 | 考试分数(五)

SELECT b1.id, b1.job, b1.score, b1.rank2 AS t_rank
FROM (
    SELECT id, job, score, COUNT(*) OVER (PARTITION BY job) AS job_num,
    RANK() OVER (PARTITION BY job ORDER BY score) AS rank1,
    RANK() OVER (PARTITION BY job ORDER BY score DESC) AS rank2
    FROM grade) AS b1
WHERE b1.rank1>=b1.job_num/2 AND b1.rank2>=b1.job_num/2
ORDER BY b1.id

全部评论

相关推荐

2024-12-18 21:20
重庆大学 数据分析师
比亚迪 工程院算法 税前大约19个
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务