SQL pattern · P20 · 14 problems
Learn it first · P20The pivot that duplicates a customerAn extra Pivoting and reshaping
Graded problems on pivoting and reshaping, from easy to hard.
14 problems · about 2 h 40 min in all
GROUP BY column changes the grain, so one customer becomes several rows.Read the lesson →Easy
Medium
02Pivot monthly revenue into category columns8 min →03Order counts by status as columns8 min →04Electronics revenue share per month9 min →05Unpivot category totals back to long form10 min →06Crosstab with row totals and a grand-total row12 min →07Two metrics per category in one pivot13 min →08Per-customer order counts by status11 min →09Distinct order statuses per customer7 min →10Distinct product categories per order8 min →11Roll order line items into one row per order12 min →