Introduction
LEAD and LAG
FIRST_VALUE, LAST_VALUE, NTH_VALUE
20. LAST_VALUE(x) with different sorting
Revision

Instruction

Great! Let's do one more exercise

Exercise

For each statistics rows with website_id = 1, show the day, the number of users, the number of users on the last day and the difference between these two values.

Stuck? Here's a hint!

Use LAST_VALUE(users), but sort by the day.

Console

Code editor

Result

TableConsole