Skip to content

MediumConceptSQL patterns for engineers

What does FIRST_VALUE or LAST_VALUE return and what is the frame trap?

What a good answer covers

They return the first or last value in the window frame. With ORDER BY the default frame ends at the current row, so LAST_VALUE returns the current row unless you set the frame to UNBOUNDED FOLLOWING.

More on SQL patterns for engineers

Flashcards for this topic