Sams Teach Yourself SQL in 10 Minutes (Fifth Edition) includes challenges at the end of some lessons. Solutions to the challenges are presented here. Just keep in mind that there is rarely one solution to a SQL challenge, so if your solutions look different but produce the desired result, that’s ok.
Write a SQL statement to determine the total number of items sold (using the quantity column in OrderItems).
SELECT SUM(quantity) AS items_ordered FROM OrderItems;
Modify the statement you just created to determine the total number of products with an id (prod_id) BR01 sold.
SELECT SUM(quantity) AS items_ordered FROM OrderItems WHERE prod_id = 'BR01';