Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Healthy Shop database
MULTIPLE JOINs – Exercises
9. Exercise 5 – Get to know the sales_history table


Don't give up! Here comes the next table!


This time we'll add information about the shop's daily sales.

The sales_history table consists of the following three columns:

  • product_id - the ID of a given product,
  • date - the date of sale, and
  • amount - the amount of a given product sold on a particular day.

For every day in the sales_history table show the sales of the products with ID's 13, 18, and 15.

Display the date, name, amount, and calorific value of a product.

Order the results by date and then by calorific value.

Stuck? Here's a hint!


FROM product p
JOIN sales_history sh
  ON = sh.product_id
JOIN nutrition_data nd
  ON nd.product_id =
WHERE IN (13, 18, 15)
ORDER BY date, calories