Katkat

List Top Customers and Monthly Order Counts in SQL

AmazonData Scientist · Technical Screen

Last updated

This question evaluates a candidate's ability to perform SQL aggregation, grouping, top‑N selection, and date-based summarization to compute customer spend and chronological monthly order counts.

Orders

order_idcustomer_idorder_dateamount
11012023-01-05120.50
21022023-01-1075.00
31012023-01-1240.25
41032023-01-15220.90
51042023-01-2015.00
Scenario

Analyst must query customer orders stored in a relational database.

Question

Write SQL to list the top three customers by total spend. Write SQL to return monthly order counts for 2023, ordered chronologically.

Hints

Group-by, aggregates, date functions, ordering.