题解 | #查找在职员工自入职以来的薪水涨幅情况#

查找在职员工自入职以来的薪水涨幅情况

https://www.nowcoder.com/practice/fc7344ece7294b9e98401826b94c6ea5

with tiaojian as (
select 
emp_no
from salaries
where
to_date="9999-01-01"
)

select 
t.emp_no,
sum(t.pt-t.salary) as growth
from(
select 
t.emp_no,
salary,
lead(salary,1)over(partition by t.emp_no order by to_date) as pt
from tiaojian t left join salaries s 
on t.emp_no=s.emp_no
) as t
group by t.emp_no
order by growth

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-07 11:20
点赞 评论 收藏
分享
不亏是提前批,神仙打架,鼠鼠不配了
站队站对牛:现在92都报工艺岗了
投递韶音科技等公司10个岗位
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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