SQL 27) 给出每个员工每年薪水涨幅超过5000的员工信息及涨幅值
给出每个员工每年薪水涨幅超过5000的员工编号emp_no
http://www.nowcoder.com/questionTerminal/eb9b13e5257744db8265aa73de04fd44
方法)表自联结得出工资涨幅大于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;