Additional SQL
Exercises
These exercises are for you to practice SQL and will not be graded.
Feel free to share your solutions in the class
forum.
Complete the following queries using the Store database.
[Joins and Functions]
- List the names of the customers who bought CPU products
last month.
- List the names of the customers who bought both CPU and
hard drives last month.
- List the names of the customers who have not bought
anything since 2004.
- List the products that nobody has bought in the
last three months.
- Find all the products ordered by John Doe, and order the
results first by the date they were ordered and then by the date they
were shipped.
- Find all the products that are more expensive than Intel
Pentium D.
- List all the products that were shipped to zip code 90001
yesterday.
[Aggregations]
- List the monthly sales of this year so far.
- List the ID, total number of items, and total dollar amount of each order.
- Find the top 3 selling products last month in terms of number of units sold.
- Find the top 3 selling products last month in terms of total revenue generated.
- Find the top 3 customer last year in terms of number of orders placed.
- Find the top 3 customer last year in terms of total dollar amount spent.