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

Instruction

Very well. Let's do a few more exercises.

Exercise

Let's analyze sales data between August 1 and August 3, 2016. For each row, show store_id, day, transactions and the ranking of the store on that day in terms of the number of transactions as compared to other stores. The store with the greatest number should get 1 from a window function. Use individual row ranks even when two rows share the same value. Name the column place_no.

Stuck? Here's a hint!

Use ROW_NUMBER() instead of RANK(). Don't forget to change this column's name to place_no.