Introduction
FIRST_VALUE, LAST_VALUE, NTH_VALUE
Revision

Instruction

Cool! Note that the column specified as the argument of LEAD may be different than the column by which we sort rows:

SELECT
name,
opened,
budget,
FROM website;

The above query will still sort the rows by the opening date, but will show the budget of the next website instead of its opening date.

Now it's your turn to write a query with LEAD(x).

Exercise

For all the statistics of the website with id = 1, show the day, the number of users and the number of users on the next day.

Stuck? Here's a hint!

Use LEAD(users) and remember about specifying the proper ORDER BY.

Code editor

TableConsole