Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Best-Selling Dish

Return the dish name with the highest total quantity ordered, and the quantity.

Table schema

Dishes(id INT PRIMARY KEY, restaurant_id INT, name VARCHAR(20))
OrderLines(order_id INT, dish_id INT, qty INT)

Sample data

Dishes
id | restaurant_id | name
1 | 1 | Pizza
2 | 1 | Pasta
3 | 2 | Burger
4 | 2 | Fries

OrderLines
order_id | dish_id | qty
1 | 1 | 2
1 | 2 | 1
2 | 1 | 1
3 | 3 | 4
4 | 4 | 1
5 | 3 | 1

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.