Kickstart 2020 with new opportunities! - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Get to know the database
6. The orders and order_items tables
Summary

Instruction

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

The orders table contains information about orders such as the order_id, customer_id, and the employee_id of the worker responsible for that order. There are also timestamp columns (order_date, required_date, and shipped_date) 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 order_items 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 order_id, product_id, and the amount paid for the specific item.

Exercise

For each order display order_id, order_date, the number of products ordered in this order (name this column product_count) and the total amount paid for that order (name this column total_amount).

To access the total_amount for each order, you should use the amount column from the orders table.

Stuck? Here's a hint!