Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Healthy Shop database
MULTIPLE JOINs – Exercises
8. Exercise 4


Good! Keep it up!


For each product display:

  • the name of the company that produced it (alias the column to ProducerName),
  • the name of the department where the product is located (alias it to DepartmentName),
  • the name of the product (alias it to ProductName),
  • the total number of carbohydrates in the product.

Your query should still consider products with no information about ProducerId, DepartmentId or ProductIds.

Stuck? Here's a hint!

Use LEFT JOINs while connecting tables.


  Prod.Name AS ProducerName,
  D.Name AS DepartmentName,
  P.Name AS ProductName,
FROM Product P
LEFT JOIN Producer Prod
  ON Prod.Id = P.ProducerId
LEFT JOIN Department D
  ON D.Id = P.DepartmentId
LEFT JOIN NutritionData ND
  ON ND.ProductId = P.Id