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; 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;