Healthy Shop database
MULTIPLE JOINs – Exercises
12. Exercise 8

Instruction

Good job! One more and we're done!

Exercise

Show the name and price of each product in the 'fruits' and 'vegetables' departments. Consider only those products that are not produced by 'GoodFoods'.

Stuck? Here's a hint!

Type:

SELECT
  p.name,
  p.price
FROM product p
JOIN producer prod
  ON p.producer_id = prod.id
JOIN department d
  ON d.id = p.department_id
WHERE d.name IN ('fruits', 'vegetables')
  AND prod.name != 'GoodFoods'

Console

Code editor

Result

TableConsole