题解 | #统计salary的累计和#

统计salary的累计和running_total

https://www.nowcoder.com/practice/58824cd644ea47d7b2b670c506a159a6

select emp_no,salary,sum(salary) over (order by emp_no) as running_total from 
salaries
where to_date ='9999-01-01'

窗口函数的使用

sum(a) over (order by b) 的含义是:

例如:

a b

1 2

3 4

5 6

按照b列排序,将a依次相加,得到结果,如下:

a b sum(a) over (order by b):

1 2 1

3 4 1+3

5 6 1+3+5

全部评论

相关推荐

你背过凌晨4点的八股文么:简历挂了的话会是流程终止,像我一样
点赞 评论 收藏
分享
牛客246576843号:建议简历对点优化,想做HR专门列出HR实习,想做运营专门列出运营实习,并且对点写出项目经历以及数据,同时在个人总结上可以多凸出和岗位的匹配度
点赞 评论 收藏
分享
评论
3
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务