Recap - Join
Part of the Fundamentals section of Coddy's SQL journey — lesson 45 of 72.
Challenge
MediumAvailable 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
4More Keywords
The IN keywordThe BETWEEN keywordThe LIKE keywordThe AS keywordRecap - Cellphone Models2Conditions
Conditions BasicsThe AND keywordThe OR keywordThe NOT keywordMultiple Conditions CombinedParenthesisBooleans5Arithmetic Operations
Mathematical OperatorsMathematical ColumnsThe Modulo OperationThe ROUND() Function3Specific Return Format
Null valuesSort Results Part 1Sort Results Part 2Recap - Cyber Security FirmLimit number of recordsRecap - Vehicle Factory6Intro Challenges
Recap - Parliamentary ElectionRecap - Police Criminal ArrestRecap - Bar Beverage ContainerRecap - Engineer new columns