题解 | 最差是第几名(二)

最差是第几名(二)

https://www.nowcoder.com/practice/165d88474d434597bcd2af8bf72b24f1

with rk_table as (select
grade,
sum(number) over(order by grade) t_rank
from
class_grade),
start_end as (with total_table as (select sum(number) as total from class_grade)
select 
case when total % 2 = 0 then floor(total / 2) else  floor(total / 2) + 1 end start,
floor(total / 2) + 1  end
from total_table)
select min(grade) from rk_table, start_end
where t_rank >= start
union
select min(grade) from rk_table, start_end
where t_rank >= end

全部评论

相关推荐

mjasjon:这种trash中厂 简历过筛概率比大厂还低(除阿里系)
投递哔哩哔哩等公司6个岗位
点赞 评论 收藏
分享
风的叶脉:不知道但我想要鞭打你( '-' )ノ)`-' ) 加油
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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