方法)表自联结得出工资涨幅大于5000的记录
- 按照salary_growth逆序排列
SELECT s2.emp_no, s2.from_date, (s2.salary - s1.salary)salary_growth FROM salaries AS s1, salaries AS s2 WHERE s1.emp_no = s2.emp_no AND s2.from_date = s1.to_date AND (s2.salary - s1.salary) > 5000 ORDER BY salary_growth DESC;