Part 96: Extremity Functions: FIRST_VALUE, LAST_VALUE & NTH_VALUE

Part 96 Technology Updated September 12, 2026

Part 96: Extremity Functions: FIRST_VALUE, LAST_VALUE & NTH_VALUE

Retrieves the first, last, or N-th value within an ordered window frame.


1. Syntax

SELECT 
  first_name,
  department,
  salary,
  FIRST_VALUE(first_name) OVER (PARTITION BY department ORDER BY salary DESC) AS top_earner
FROM employees;

Key Takeaways

  • Access boundary values within partitions directly.

In Part 97, we explore Window Frames: ROWS BETWEEN vs RANGE BETWEEN!