Question: Complete the following exercise: Write SQL statements for questions given below for the PetStore database ( Script for PetStore database is available in the Modules

Complete the following exercise:
Write SQL statements for questions given below for the PetStore database (Script for PetStore database is
available in the Modules section on Canvas). Save your SQL SELECT statements as Qry1, Qry2,..., Qry7 in a
text file (e.g., Notepad file). Please make sure to upload text file containing your SQL SELECT statements to
Canvas. Include team member names in the first line of the text file.
Note: If the database in which you execute the PetStore database script has tables with table names listed below,
please delete these tables to prevent error. Table names in PetStore database:
MerchandiseOrder OrderItem Merchandise SaleItem
CustomerAccount Preferences Breed
List the dog breeds for which the Pet Store has sold one or more dogs during the first three months of 2007
(SaleDate in the Sale table; January 2007, February 2007, March 2007). Display Animal Category, Breed,
and Number of dogs sold for each of these dog breeds in descending order of number of dogs sold (Note-
Please refer to the Sale, SaleAnimal, and Animal tables).
Display CustomerID, FirstName, and LastName for customers who have more than three sales transactions.
Display the result-set in ascending order of customer last name, and for each last name in ascending order
of customer first name (Note - Please refer to the Customer and Sale tables).
Display CustomerID, FirstName, and LastName for customers who have no sales transactions. Display the
result-set in ascending order of customer last name, and for each last name in ascending order of customer
first name (Note - Please refer to the Customer and Sale tables).
For employees who have sold one or more animals, display EmployeeID, FirstName, LastName, and the
number of different categories of animals sold (Please refer to the Employee, Sale, SaleAnimal, and Animal
tables).
Which cat breed(s) had the highest total sales during the first three months of 2007? Display the Category,
Breed, total sales generated, and the average sale price for this cat breed(s). Display the result-set with
appropriate column names (Note - Please refer to the Sale, SaleAnimal, and Animal tables).
List all birds sold for sale price (SalePrice column)150% more than their cost (Cost column in
AnimalOrderItem table) during the first three months of 2007(January 2007, February 2007, March 2007).
Display AnimalID, Category, Breed, Cost, SalePrice, and Profit for each of these birds in descending order
of the Profit (SalePrice - Cost) amount (Note - Please refer to the AnimalOrderItem, Animal, SaleAnimal,
and Sale tables).
List AnimalID, Category, Breed, Gender, and SalePrice for all cats that sold (sale price) for more than the
average sale price of all cats Pet Store has sold. Display the result-set in descending order of sale price (Note
Please refer to the Sale, SaleAnimal, and Animal tables).
 Complete the following exercise: Write SQL statements for questions given below

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!