@Harris Christiansen (christih@purdue.edu) HarrisChristiansen.com
February 2018
- Given the provided
dbseed
, provide the SQL queries for the following problems: - Answers are found in
project1_christih.sql
- For each product, find the ProductName and AverageDiscount given on that product.
- For each unique PhoneNo, determine the CountOfCustomers with that given phone number - sorted by CountOfCustomers (descending)
- For products with 0 stock, list the ProductId, ProductName, FirstName, LastName - sorted by ProductId (ascending)
- For each customer, list the CustomerId, LastName, AverageDiscount - sorted by CustomerId (ascending)
- Find the top 3 products with the highest number of sales. List ProductName, NumberOfItemsSold - sorted by NumberOfItemsSold (descending)
- For each customer with a delayed order, list FirstName, LastName, PhoneNo - sorted by FirstName (ascending)
- Find the top 4 customers who generated the highest revenue. List CustomerId, Revenue - sorted by Revenue (descending)
- Find the top 3 product categories with the highest number of unique customers. List Category, DistinctNumberOfCustomers - sorted by DistinctNumberOfCustomers (descending)
- Find customers with >$1000 in currently delayed orders. List FirstName, LastName, OrderId, TotalAmount - sorted by TotalAmount(descending)
- List suppliers who supply at least 3 unique products. List SupplierId, LastName, NumberOfDifferentProducts - sorted by NumberOfDifferentProducts (descending)