Healthy Shop database
MULTIPLE JOINs – Exercises
6. Exercise 2

Instruction

Good start! How about this one?

Exercise

For each fruit (found in the fruits department) show the product's shelf id, name, price, and number of calories.

Stuck? Here's a hint!

Type:

SELECT
  p.shelf_id,
  p.name,
  p.price,
  nd.calories
FROM product p
JOIN department d
  ON p.department_id = d.id
JOIN nutrition_data nd
  ON nd.product_id = p.id
WHERE d.name = 'fruits'

Console

Code editor

Result

TableConsole