All questions
Advanced · SQL · Window functions
Each customer's latest order
Commonly asked: "Latest record per group" is asked everywhere · ~10 min
Return customer_id, order_id and created_at of each customer's most recent order (ties: highest order id). Sort by customer_id.
Checking your membership…
More SQL coding questions
- Duplicate product lines in an orderIntermediate · Data quality
- Orders pointing to missing customersIntermediate · Data quality
- Salary difference from team averageAdvanced · Window functions
- Day-over-day order changeAdvanced · Window functions
