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
Using PARTITION BY ORDER BY with Analytical Functions
18. Practice Time!
Summary and Review

Instruction

Okay, let's practice using PARTITION BY ORDER BY with analytic functions!

Exercise

For each row of sales figures, show the following information: StoreId, Day, Revenue, the Revenue from seven days before (LastWeekRevenue), and the Ratio of today's revenue to last week's revenue. This ratio should be expressed as a percentage with two decimal places.

Stuck? Here's a hint!

Use, among others:

LAG(Revenue,7) OVER(PARTITION BY StoreId ORDER BY Day ASC)