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

Revenue per Restaurant

Dishes cost 10 each (Pizza, Pasta) or 8 each (Burger, Fries), stored in Price. Return each restaurant name and its revenue, ordered by revenue descending.

Table schema

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

Sample data

Restaurants
id | name
1 | Roma
2 | Grill

Dishes
id | restaurant_id | price
1 | 1 | 10
2 | 1 | 10
3 | 2 | 8
4 | 2 | 8

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.