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

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

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

with t1 as
(select employees.emp_no,salary min_salary 
from employees join salaries using(emp_no)
where hire_date=from_date ),
t2 as
(select emp_no,salary max_salary,to_date
from salaries
where (emp_no,to_date) in
(select emp_no ,max(to_date) max_to_day
from salaries
group by emp_no
))

select t1.emp_no,(max_salary-min_salary) growth
from t1 join t2 using(emp_no)
where to_date='9999-01-01'
order by growth

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-25 17:23
做完了怎么知道过没过呀
投递京东等公司10个岗位
点赞 评论 收藏
分享
苍蓝星上艾露:这简历。。。可以试试我写的开源简历优化工具https://github.com/weicanie/prisma-ai
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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