Skip to content
RED SAGSkills
hard20 pts · first answer countssqlwindow-functions

LAST_VALUE returns the current row

prices has (d, price): (1, 10), (2, 12), (3, 15). A developer expects every row to show the latest price, 15. What does the query actually return for d = 1, 2, 3?

SELECT d, LAST_VALUE(price) OVER (ORDER BY d) AS latest
FROM prices ORDER BY d;
Choose one answer