E-commerce & Retail Analytics Path · Mission 16 of 30Hard

Most recent order per customer

Use ROW_NUMBER OVER (PARTITION BY customer_id ORDER BY created_date DESC) + WHERE rn = 1 to dedup multi-order customers down to one row each. The most universally-applied 'pick the latest per group' window pattern.

The Brief

You'll practice

ROW_NUMBERSelf-joinDedup