Most Frequently Ordered Item per Store
Problem
**[Asked at Instacart]**
For each store on the Instacart platform, find the **item ordered most
frequently** (by total number of order-line appearances).
Return `store_id`, `item_name`, and `order_count`,
ordered by store then item name.
Tables
Example rows — the live problem includes the full dataset.
stores
| store_id | store_name |
|---|
items
| item_id | item_name |
|---|
orders
| order_id | store_id | order_date |
|---|
order_items
| oi_id | order_id | item_id |
|---|
Expected output
Your answer should return 2 rows with the columns store_id, item_name, order_count.
Starter code (SQL)
SELECT *
FROM stores;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock