无
| emp_no | growth |
|---|---|
| 10011 | 0 |
| 省略 | 省略 |
| 10010 | 54496 |
| 10004 | 34003 |
SQL:
select sCurrent.emp_no,(sCurrent.salary-sStart.salary)as growth
from(select emp_no,salary from salaries where to_date=‘9999-01-01‘)as sCurrent,
(select e.emp_no,c.salary from employees e,salaries c where e.emp_no=c.emp_no and c.from_date=e.hire_date)as sStart
where sCurrent.emp_no=sStart.emp_no
order by growth
分别找出 当前的工资 以及入职时工资 将这两张表进行连接 然后计算出growth
SQL-21 查找所有员工自入职以来的薪水涨幅情况,给出员工编号emp_no以及其对应的薪水涨幅growth,并按照growth进行升序
原文:https://www.cnblogs.com/kexiblog/p/10683481.html