Question: SQL Server - Assignment 5 Total Points 8 5 . ( Questions 1 - 3 are each worth 1 5 points. Questions 4 - 5
SQL Server Assignment
Total Points
Questions are each worth points. Questions are each worth points
For this weeks assignment, you will use the MyGuitarShop database Type up the scripts for
the following questions as a script file or a document and upload it to Moodle. For each
question, include the script, a comment with the count of rows returned and also include a
snippet of the result set. It could be a screenshot of the first five rows of the result set.
Create a view named CustomerAddresses that shows the shipping and billing addresses for each
customer in the MyGuitarShop database.
This view should return these columns from the Customers table: CustomerID, EmailAddress,
LastName and FirstName.
This view should return these columns from the Addresses table: BillLine BillLine BillCity,
BillState, BillZip, ShipLine ShipLine ShipCity, ShipState, and ShipZip.
Use the BillingAddressID and ShippingAddressID columns in the Customers table to determine
which addresses are billing addresses and which are shipping addresses.
Hint: You can use two JOIN clauses to join the Addresses table to Customers table twice once for
each type of address
Write a SELECT statement that returns these columns from the CustomerAddresses view that you
created in exercise : CustomerID, LastName, FirstName, BillLine
Write an UPDATE statement that updates the CustomerAddresses view you created in exercise so it
sets the first line of the shipping address to Westwood Blvd for the customer with an ID of
Create a view named OrderItemProducts that returns columns from the Orders, OrderItems, and
Products tables.
This view should return these columns from the Orders table: OrderID, OrderDate, TaxAmount, and
ShipDate.
This view should return these columns from the OrderItems table: ItemPrice, DiscountAmount,
FinalPrice the discount amount subtracted from the item price Quantity, and ItemTotal the
calculated total for the item
This view should return the ProductName column from the Products table.
Create a view named ProductSummary that uses the view you created in exercise This view should
return some summary information about each product.
Each row should include these columns: ProductName, OrderCount the number of times the product
has been ordered and OrderTotal the total sales for the product
Write a SELECT statement that uses the view that you created to get total sales for the five best
selling products.
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
