题解 | 查找在职员工自入职以来的薪水涨幅情况
查找在职员工自入职以来的薪水涨幅情况
https://www.nowcoder.com/practice/fc7344ece7294b9e98401826b94c6ea5
select 在职表的.emp_no,(在职表的.salary-入职表的.salary) growth from
( select t1.emp_no,t2.salary from employees t1
join salaries t2 on t1.emp_no = t2.emp_no
where t1.hire_date >= t2.from_date
) 入职表的
join
( select t1.emp_no,t2.salary from employees t1
join salaries t2 on t1.emp_no = t2.emp_no
where t2.to_date = '9999-01-01'
) 在职表的
on 入职表的.emp_no = 在职表的.emp_no
order by growth
查看3道真题和解析