FIRST_VALUE, LAST_VALUE
Published July 26, 2025
By Sai Sree Ram Gundepudi
FIRST_VALUE and LAST_VALUE
Retrieve the first or last value in a sorted partition.
SELECT department_id, last_name, salary,
FIRST_VALUE(salary) OVER (PARTITION BY department_id ORDER BY salary DESC) AS highest
FROM employees;