Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Quick refresher
PARTITION BY ORDER BY with ranking
PARTITION BY ORDER BY with window frames
PARTITION BY ORDER BY with analytical functions
18. Practice 1
Summary

Instruction

Okay, let's practice the usage of PARTITION BY ORDER BY with analytical functions a bit more.

Exercise

For each row of the sales figures, show the following information: store_id, day, revenue, revenue a week before and the ratio of revenue today to the revenue a week before expressed in percentage with 2 decimal places.

Stuck? Here's a hint!

Use, among others:

LAG(revenue,7) OVER(PARTITION BY store_id ORDER BY
day)