Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
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!

To get also products that don't have a producer, you'll need to join the producer table, like so:

FROM product p
LEFT JOIN producer prod
  ON p.producer_id = prod.id
JOIN department d
  ON d.id = p.department_id

To make sure the products aren't produced by 'GoodFoods', use the following condition in WHERE:

(prod.name != 'GoodFoods' OR prod.id IS NULL)