Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Medical Center database
Non primary-foreign key JOINs
Non-equi JOINs
Non-equi self JOINs
24. Exercise 2
Summary

Instruction

Well done! Here comes the next exercise on the Orders table.

Exercise

For each order placed during the promotional period, show its ID, the ID of the ordered product, the date when the order was placed, and the total amount that was paid for the order (amount * price). Name the column TotalAmount.

Stuck? Here's a hint!

Type:

SELECT
  Orders.Id,
  Orders.ProductId,
  OrderDate,
  Price * Amount AS TotalAmount
FROM Orders
JOIN ProductPrice
  ON Orders.ProductId = ProductPrice.ProductId
  AND OrderDate BETWEEN StartDate AND EndDate