Introduction
Quick refresher
PARTITION BY ORDER BY with ranking
12. Practice 3
PARTITION BY ORDER BY with window frames
PARTITION BY ORDER BY with analytical functions
Revision

Instruction

Ok! One more, please.

Exercise

Divide the sales results for each store into four groups based on the number of transactions and for each store, show the rows in the group with the lowest numbers of transactions: store_id, day, transactions.

Stuck? Here's a hint!

Remember to use temporary table.

Use NTILE(4) OVER(PARTITION BY store_id ORDER BY transactions).

Console

Code editor

Result

TableConsole