Revenue per Restaurant
Medium
Restaurant & Food Delivery
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.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.