标签:现在 question char body ble name create str select
1、题目描述:
输入描述:
无
输出描述:
emp_no | growth |
---|---|
10011 | 0 |
省略 | 省略 |
10010 | 54496 |
10004 | 34003 |
2、代码:
充分利用中间临时表,先查出一个表,表里面存着 工号+入职时薪水,再查另一个表,表里存着 工号+现在的薪水,然后再对着两个临时表进行查询。
select ns.emp_no,(ns.salary-hs.salary) as 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‘) as ns 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) as hs on ns.emp_no=hs.emp_no order by growth;
标签:现在 question char body ble name create str select
原文地址:https://www.cnblogs.com/guoyu1/p/12244719.html