Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Get to know the database
6. The Orders and OrderItems tables
Basic revenue metrics
Summary

Instruction

Very well done! Finally, we'll take a look at the Orders and OrderItems tables.

The Orders table contains information about orders such as the OrderId, CustomerId, and the EmployeeId of the worker responsible for that order. There are also timestamp columns (OrderDate, RequiredDate, and ShippedDate) and a lot of columns related to the shipment process. Finally, there is the Amount column, which shows the total amount paid for that order.

The OrderItems table, in turn, stores information about what was actually ordered in a given order. Each row represents a single line item from an order. You can find the OrderId, ProductId, and the Amount paid for the specific item.

Exercise

For each order display OrderId, OrderDate, the number of products ordered in this order (name this column ProductCount) and the total amount paid for that order (name this column TotalAmount).

To access the TotalAmount for each order, you should use the Amount column from the Orders table.

Stuck? Here's a hint!