Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How to code summary queries My Guitar Shop Exercises 1. Write a SELECT statement

ID: 3535678 • Letter: H

Question

How to code summary queries

My Guitar Shop Exercises

1. Write a SELECT statement that returns one row for each category that has products with these columns:

The CategoryName column from the Categories table

The count of the products in the Products table

The list price of the most expensive product in the Products table

Sort the result set so the category with the most products appears first.

2. Write a SELECT statement that returns one row for each customer that has orders with these columns:

The EmailAddress column from the Customers table

A count of the number of orders

The total amount for each order (Hint: First, subtract the discount amount from the price. Then, multiply by the quantity.)

Return only those rows where the customer has more than than 1 order.

Sort the result set in descending sequence by the sum of the line item amounts.

3. Write a SELECT statement that answers this question: Which customers have ordered more than one product? Return these columns:

The email address from the Customers table

The count of distinct products from the customers orders

Explanation / Answer

Please rate ..


1)

I assumed the column names // Change to as it need basis on your table columns

Select CategoryName from Categories


Select count(Product_No) from Products


Select Max(Price) From Products


2)


Select Email From Customers

Select count(Order_No) From Orders

Select Order_Id,[(Price-Discount)*100] As Total From  Order OÂ

Select C.CustomerId from Customer C, Orders O where O.CustomerId=O.CustomerId group by C.CustomerId having Count(O.OrderId)>1




3)


Select C.CustomerId,Sum(ProductId) From Customer C, Orders O where O.CustomerId=C.CustomerId and O.OrderId=P.OrderId group by C.CustomerId having Sum(ProductId)>1

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote