Unit 06 · Practice
Practice
Three questions. Each one shows you an answer an AI gave about Northwind, and the query it ran. Run your own queries to check it, then type the number the question asks for.
It's short on purpose, because the midterm review is this week's main assignment. It's on the midterm check-in page.
The sales team asks how many orders have included at least one beverage. An AI answers:
93 orders included a beverage.
It ran this query.
SELECT COUNT(*)
FROM OrderDetails
JOIN Products ON OrderDetails.ProductID = Products.ProductID
JOIN Categories ON Products.CategoryID = Categories.CategoryID
WHERE CategoryName = 'Beverages';
Check its answer. How many orders included at least one beverage?
What is one row in OrderDetails?
Marketing wants a list of every Northwind customer in the USA, with the number of orders each one has placed. An AI gives you a list of 8 customers. It ran this query.
SELECT CustomerName, COUNT(*)
FROM Customers
JOIN Orders ON Customers.CustomerID = Orders.CustomerID
WHERE Country = 'USA'
GROUP BY CustomerName;
Check its answer. How many customers in the USA are missing from its list?
Which customers can a JOIN with Orders never return?
Purchasing asks which product has been on the most orders. An AI answers:
Raclette Courdavault, on 14 orders.
It ran this query.
SELECT ProductName, COUNT(*)
FROM OrderDetails
JOIN Products ON OrderDetails.ProductID = Products.ProductID
GROUP BY ProductName
ORDER BY COUNT(*) DESC
LIMIT 1;
Check its answer. How many products have been on 14 orders?
Look at more than the top row.
When you're done, download your submission file and upload it to this unit's practice assignment in Canvas. It carries a summary of your progress and the record of every attempt you made on this page. You can submit as many times as you like; the last one counts.
Attempts are saved in this browser. To keep going on another computer, download your submission here and resume from it there.