Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
FIRST_VALUE, LAST_VALUE, NTH_VALUE
19. LAST_VALUE(x) – practice
Summary

## Instruction

The query worked fine this time. Here's one thing you should remember: while FIRST_VALUE works well with the default window frame, LAST_VALUE needs an explicit definition of the right window frame to actually make sense.

Of course, you can order by one column and return the other:

SELECT
name,
budget,
LAST_VALUE(budget) OVER(
ORDER BY opened
ROWS BETWEEN UNBOUNDED PRECEDING
AND UNBOUNDED FOLLOWING)
FROM website;


Here we show the budget of the most recent website (not the greatest budget).

Show the statistics for website_id = 1. For each row, show the day, the number of impressions and the number of impressions on the day with the most users.
Use LAST_VALUE(impressions) and sort by the number of users.