Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Get to know the database
7. The orders and order_items tables
Summary

Instruction

Very well done! Let's now take a look at the orders and order_items tables.

The orders table contains general information about an order: the order_id, customer_id, and employee_id related to that sale. There are also timestamp columns (order_date and shipped_date) and many columns related to the shipment process.

The order_items table contains information about order items. Each row represents a single item from an order. You'll find the order_id and product_id alongside unit_price, quantity, and (possibly) discount.

Exercise

Display the list of products purchased in the order with ID equal to 10250. Show the following information: product name (product_name), the quantity of the product ordered (quantity), the unit price (unit_price from the order_items table), the discount (discount), and the order_date. Order the items by product name.

Stuck? Here's a hint!

You will need to join three tables: order_items, orders, and products. Remember to select only the order with ID of 10250 and to order the items by product name.

Click here to preview the diagram or here to open it in a new tab.

Code editor
tableconsole