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
Revision

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 rank = 1. Use individual row ranks even when two rows share the same value.

Stuck? Here's a hint!

Use ROW_NUMBER() instead of RANK().

Console

Code editor

Result

TableConsole