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

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

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


# # 入职的薪水表
with a as
(SELECT e.emp_no,s.salary as first_salary
from employees e 
left join salaries s on e.emp_no = s.emp_no
where e.hire_date = s.from_date )

select num,(now_salary - first_salary) as growth 
from 
(select* from a
 LEFT JOIN
 (SELECT e.emp_no as num,s.salary as now_salary
  from employees e 
  left join salaries s on e.emp_no = s.emp_no
  where s.to_date = '9999-01-01')b
 on a.emp_no = b.num
)c
where  num is not null 
and (now_salary - first_salary) is not NULL
order by growth
全部评论

相关推荐

认真搞学习:这个真喷不了,你是我见过最美的牛客女孩
点赞 评论 收藏
分享
05-01 22:41
中南大学 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务