Question: For this activity, we will using the AdventureWorks database. (Here is the link to download the sample database if needed. https://archive.codeplex.com/?p=msftdbprodsamples Select the oltp file)
For this activity, we will using the AdventureWorks database.
(Here is the link to download the sample database if needed. https://archive.codeplex.com/?p=msftdbprodsamples
Select the oltp file)
--Query 1--Use PIVOT to complete this query.--What are the average sales for in-store and online purchases for each-- day of the week?--Display the name of the day, the average sales subtotal for online orders,-- and average sales subtotal for in-store orders for each day of the week-- (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday). The days-- of the week are to be the headers across the top and 0 and 1 for in-store-- and online for the rows.-- You can use a CASE statement to replace the o and 1 for In Store and-- Online. This is not required. It is just if you are interested.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
