Top meals by cost
Alice from Finance wants to know what Delivr's top 5 meals are by overall cost; in other words, Alice wants to know the 5 meals that Delivr has spent the most on for stocking.
You're provided with an aggregate query; you'll need to fill in the blanks to get the output Alice needs.
Note: Recall that in the meals table, meal_price is what the user pays Delivr for the meal, while meal_cost is what Delivr pays its eateries to stock this meal.
Este ejercicio forma parte del curso
Analyzing Business Data in SQL
Instrucciones del ejercicio
- Calculate cost per meal ID.
- Set the
LIMITto 5.
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
SELECT
-- Calculate cost per meal ID
___,
___ AS cost
FROM meals
JOIN stock ON meals.meal_id = stock.meal_id
GROUP BY meals.meal_id
ORDER BY cost DESC
-- Only the top 5 meal IDs by purchase cost
LIMIT ___;