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

Instruction

That's right. One more exercise and we move on to PARTITION BY ORDER BY.

Exercise

For each sales row between August 1 and August 7, 2016, show the store_id, day, number of transactions, the total number of transactions on that day in any store and the ratio of the two last columns shown as percentage rounded to integer values.

Stuck? Here's a hint!

To avoid integer division, use CAST(transactions AS numeric). Remember to multiply the division result by 100 and then use ROUND(...).