思路:找到在职员工(有行to_date = '9999-01-01'),用最后的薪水-最初的薪水(极差)
select
distinct emp_no
,最大日期的工资 - 最小日期的工资 as growth
from
(
select
*
,first_value(to_date)over(partition by emp_no order by to_date desc) 最大日期
,first_value(salary)over(partition by emp_no order by to_date desc) 最大日期的工资
,first_value(salary) over(partition by emp_no order by to_date) 最小日期的工资
from salaries
) a
where 最大日期 = '9999-01-01'
order by 2