首先找出当前员工号和工资形成一个表b,然后找出入职时员工号和工资形成一个表a, 最后两表合并后求差排序。


select a.emp_no, (b.salary-a.salary) Growth
from 
(select e.emp_no, s.salary
from employees e 
left join salaries s 
on e.emp_no = s.emp_no
where s.to_date='9999-01-01') b
join
(select e.emp_no, s.salary
from employees e 
left join salaries s 
on e.emp_no = s.emp_no
where s.from_date=e.hire_date) a
on b.emp_no=a.emp_no
order by Growth;