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 Qry Qry Qry in a
text file eg 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
SaleDate in the Sale table; January February March 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 resultset 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
resultset 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 breeds had the highest total sales during the first three months of Display the Category,
Breed, total sales generated, and the average sale price for this cat breeds Display the resultset with
appropriate column names Note Please refer to the Sale, SaleAnimal, and Animal tables
List all birds sold for sale price SalePrice column more than their cost Cost column in
AnimalOrderItem table during the first three months of January February March
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 resultset in descending order of sale price Note
Please refer to the Sale, SaleAnimal, and Animal tables
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
