Mod5 InClassProblems
Mod5 InClassProblems
MODULE 5: SQL
In Class Problems, E5.1
E5.1 Write the SQL queries that accomplish the following tasks in the ZAGIMORE Retail Company
Sales Department Database:
E5.1 Write the SQL queries that accomplish the following tasks in the ZAGIMORE Retail Company
Sales Department Database:
E5.1.3 Display the CustomerName and CustomerZip for all customers, sorted alphabetically by
CustomerName.
E5.1.4 Display the RegionIDs of regions where we have stores (use only table STORE and do not
display the same information more than once).
E5.1.5 Display all the information for all stores whose RegionID value is C.
E5.1.6 Display CustomerID and CustomerName for all customers whose CustomerName begins with
a letter T.
E5.1.7 Display the ProductID, ProductName, and ProductPrice for products with a Product
Price of $100 or higher.
E5.1.8 Display the ProductID, ProductName, ProductPrice, and VendorName for all
products. Sort the results by ProductID.
E5.1.9 Display the ProductID, ProductName, ProductPrice, VendorName, and CategoryName for
all products. Sort the results by ProductID.
E5.1.10 Display the ProductID, ProductName, and ProductPrice for products in the category whose
CategoryName value is Camping. Sort the results by ProductID.
E.5.1.11 Display the ProductID, ProductName, and ProductPrice for products that were sold in the
zip code 60600. Sort the results by ProductID.
E.5.1.12 Display the ProductID, ProductName, and ProductPrice for Products whose VendorName
is Pacifica Gear that were sold in the region whose RegionName is Tristate. Do not display the same
information more than once (i.e., do not show the same product more than once). Sort the results by
ProductID.
E5.1.13 Display the TID, CustomerName, and TDate for sales transactions involving a
customer buying a product whose ProductName is Easy Boot.
E5.1.14 Display the RegionID, RegionName, and number of stores in the region for all regions.
E5.1.15 For each product category, display the CategoryID, CategoryName, and average price
of a product in the category.
E5.1.16 For each product category, display the CategoryID and the total number of items purchased
in the category.
E5.1.17 Display the RegionID, RegionName, and the total amount of sales (in dollars) in the
region for all regions. Display the total amount of sales as AmountSpent.
E5.1.18 Display the TID and the total number of items (of all products) sold within the transaction
for all sales transactions whose total number of items (of all products) sold
within the transaction is greater than five.
E5.1.19 For each vendor whose product sales exceed $700, display the VendorID, VendorName,
and total amount of sales in dollars. Display the total amount of sales as TotalSales.
E5.1.20 Display the ProductID, ProductName, and ProductPrice of the cheapest product.
E5.1.21 Display the ProductID, ProductName, and VendorName for products whose price is
below the average price of all products.
E5.1.22 Display the ProductID and ProductName of the product for the products whose total
quantity sold in all transactions is greater than 2. Sort the results by ProductID.
E5.1.23 Display the ProductID for the product that has been sold the most within all transactions
(i.e., that has the highest total quantity sold summarized across all transactions).