Instruction
Good! Keep it up!
Exercise
For each product display:
- the name of the company that produced it (alias the column to
producer_name), - the name of the department where the product is located (alias it to
department_name), - the name of the product (alias it to
product_name), - the total number of carbohydrates in the product.
Your query should still consider products with no information about producer_id or department_id.
Stuck? Here's a hint!
Use LEFT JOINs while connecting tables.
Type:
SELECT prod.name AS producer_name, d.name AS department_name, p.name AS product_name, nd.carbohydrate FROM product p LEFT JOIN producer prod ON prod.id = p.producer_id LEFT JOIN department d ON d.id = p.department_id LEFT JOIN nutrition_data nd ON nd.product_id = p.id



