Problems for You to Solve

Below, we show you the request statement and the name of the solution query in the sample databases. If you want some practice, you can work out the SQL you need for each request and then check your answer with the query we saved in the samples. Don’t worry if your syntax doesn’t exactly match the syntax of the queries we saved—as long as your result set is the same.

Sales Orders Database

1.“What is the average retail price of a mountain bike?”

You can find the solution in CH12_Average_Price_Of_A_Mountain_Bike (1 row).

2.“What was the date of our most recent order?”

You can find the solution in CH12_Most_Recent_Order_Date (1 row).

3.“What was the total amount for order number 8?”

You can find the solution in CH12_Total_Amount_For_Order_Number_8 ...

Get SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.