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

统计salary的累计和running_total

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

SELECT emp_no,
       salary,
       sum(salary) over (order by emp_no) running_total
FROM salaries
where to_date='9999-01-01'
;
  1. 窗口函数,这里不需要分组,就不用partition by
  2. order by的默认就是第一行到当前行,所以不需要特意指出
    rows between unbounded preceding 
         and  current row
    

```

全部评论

相关推荐

05-30 12:03
山西大学 C++
offer来了我跪着...:不是骗子,等到测评那一步就知道为啥这么高工资了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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