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

Note: Using SQL Server 2014. Database being used: MyGuitarShop. As far as I know

ID: 3787348 • Letter: N

Question

Note: Using SQL Server 2014. Database being used: MyGuitarShop. As far as I know, you CANNOT use 'create procedure'. Do not create your own database please.

Side note: The (1) and (2) displayed below represent the # of variables. Total variables being used in the question is '2'.

Write a script that finds (1) The name of the customer who made the largest order and (2) the value of that largest order. Store the name and the value of the order in two different variables and then print using the two variables. A sample print statement with the correct customer and order value “The largest order of $1678.60 was made by Christine Brown” Hint: This problem may require you to use a table variable to store information that you will use to get to the required information. There may be multiple ways to solve this problem.

Hint: This problem may require you to use a table variable to store information that you will use to get to the required information. There may be multiple ways to solve this problem.

**Below I have included the possible information on tables and columns that may be needed.**

Customers Table; Columns: CustomerID(PK), FirstName, LastName

OrderItems Table; Columns: ItemID(PK), OrderID(FK), ProductID(FK),ItemPrice

Orders Table; Columns: OrderID(PK), CustomerID(FK) , (others dont matter)

Products Table; Columns: ProductID(PK), CategoryID(FK), ListPrice

Explanation / Answer

SQL MAX() function would let the user know to get the maximum out of the lot.

1. The name of the customer who made the largets order is..

SELECT OrderID(MAX) FROM Orders GROUP BY CustomerID desc,
GO

This can get the results from the table to get maximum list of orders by ID..

Select * from Customers where CustomerID = ' '
Go

This query would get the user the name of the person who had ordered the maximum

2.

This can help the user to print the price.

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