Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
5. The purchase table
Referring to other tables
INSERT, UPDATE, and DELETE with subqueries


Finally, we come to the last table, purchase. Let's explore it.


Select all columns from the purchase table. In this store, each purchase represents an order on a given date. The table consists of the following columns:

  • id – Uniquely identifies each order on a given date.
  • product_id – The ID of the product included in the order.
  • quantity – How many of this product is in the order.
  • total_price – The total price for this product purchased.
  • customer_id – The ID of the customer who made the purchase.
  • employee_id – The ID of the employee who made the sale.
  • order_date – The date when the product was purchased.
  • is_completed – A boolean value denoting if the purchase was completed (true) or not (false).