# 窗口函数
SELECT
    emp_no,growth
FROM(
    SELECT
        emp_no,
        to_date,
        FIRST_VALUE(salary) OVER(PARTITION BY emp_no ORDER BY from_date DESC) -
        FIRST_VALUE(salary) OVER(PARTITION BY emp_no ORDER BY from_date) growth
    FROM
        salaries
) t
WHERE
    to_date = '9999-01-01'
ORDER BY
    growth