Introduction
LEAD and LAG
13. Practice 1
FIRST_VALUE, LAST_VALUE, NTH_VALUE
Revision

Instruction

Ok, let's do two more analytical exercises for practice.

Exercise

RPM (revenue per thousand impressions) is defined as the revenue divided by the number of impressions, times 1000.

RPM = (revenue / number of impressions) * 1000

For each statistics row with website_id = 2, show the day, the RPM and the RPM 7 days later. Rename the columns to RPM and RPM_7.

Stuck? Here's a hint!

To avoid integer division, use CAST(column AS numeric).

Console

Code editor

Result

TableConsole