0% found this document useful (0 votes)
124 views

Mod5 InClassProblems

This document provides 24 SQL queries to perform tasks on a database for a retail company. The queries retrieve information from tables like REGION, STORE, CUSTOMER, PRODUCT, and TRANSACTION. They display data fields like region IDs, store details, customer names, product prices, total sales amounts, and more. The queries are also sorted and filtered in different ways, such as by region, name, price, total items sold, and other criteria.

Uploaded by

Kristen Butts
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
124 views

Mod5 InClassProblems

This document provides 24 SQL queries to perform tasks on a database for a retail company. The queries retrieve information from tables like REGION, STORE, CUSTOMER, PRODUCT, and TRANSACTION. They display data fields like region IDs, store details, customer names, product prices, total sales amounts, and more. The queries are also sorted and filtered in different ways, such as by region, name, price, total items sold, and other criteria.

Uploaded by

Kristen Butts
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

TBANLT411 Data Management Instructor: Michael Turek

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.1 Display all the records in the table REGION.

E5.1.2 Display the StoreID and StoreZip for all stores.

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.

Database Systems, Edition 2.0 (Jukic et. al.) Chapter 05


TBANLT411 Data Management Instructor: Michael Turek

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).

Database Systems, Edition 2.0 (Jukic et. al.) Chapter 05


TBANLT411 Data Management Instructor: Michael Turek

E5.1.24 Rewrite Query 30 using a join statement (no nested queries).

E5.1.25 Rewrite Query 31 using a join statement (no nested queries).

Database Systems, Edition 2.0 (Jukic et. al.) Chapter 05

You might also like