Menu
Coddy logo textTech

Recap - Join

Part of the Fundamentals section of Coddy's SQL journey — lesson 45 of 72.

challenge icon

Challenge

Medium

Available tables and columns:

  • <strong>orders</strong>: <strong>id</strong>, <strong>customer_id</strong>
  • <strong>products</strong>: <strong>id</strong>, <strong>unit_price</strong>, <strong>units_in_stock</strong>
  • <strong>order_items</strong>: <strong>id</strong>, <strong>order_id</strong>, <strong>product_id</strong>, <strong>quantity</strong>

Find the customer IDs of customers who have ordered products with a unit price less than 10, and list the total quantity of those cheap products each customer has ordered.

Return following columns:

  • customer_id
  • total_quantity (the sum of quantities of products with a unit price < 10 for each customer)

Try it yourself

All lessons in Fundamentals