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' or the producer is unknown.

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.ProducerId = Prod.Id
JOIN Department D
  ON D.Id = P.DepartmentId

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

(Prod.Name != 'GoodFoods' OR Prod.Id IS NULL)