Introduction
LEAD and LAG
14. Practice 2
FIRST_VALUE, LAST_VALUE, NTH_VALUE
Revision

Instruction

Perfect. One more!

Exercise

Let's define conversion rate as the number of clicks divided by the number of impressions, multiplied by 100 to obtain percentages.

For website_id = 1 and dates between May 15 and May 31, show each statistics row: day, clicks, impressions, conversion rate and the conversion rate on the previous day.Name the last column as previous_conversion.

Stuck? Here's a hint!

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

Console

Code editor

Result

TableConsole