Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This exercise is based on the Sales. Sales Order Header table in the AdventureWorks2008 database. This table can be found on the SQL server

 

This exercise is based on the Sales. Sales Order Header table in the AdventureWorks2008 database. This table can be found on the SQL server via remote desktop. SalesOrder Header (Sales) SalesOrderID RevisionNumber OrderDate Due Date ShipDate Status OnlineOrderFlag SalesOrderNumber Purchase OrderNumber AccountNumber CustomerID Please write the SQL statements to answer the following questions. 1. How many customers who made at least one order in this period? 2. What is the total net sales (before tax and freight) in this period? 3. What is the average shipping cost for online orders? (Hint: online orders have OnlineOrderFlag=1) 4. Show the number of orders placed by each customer and sort the result by the number of orders in descending order 5. Show the earliest order date, the most recent order date, and the total amount for each customer. Sort the result by CustomerID in ascending order 6. Show the number of orders, total sales amount, and average order amount by order type (online vs. store) 7. Show the net sales (before tax and freight) by territory and sales person. Orders without associated sales person should not be included. Sort the results by territoryid and salespersonid in ascending orders 8. Are there any customers who have both online and offline orders? 9. What is the average tax rate by territory? Did the company charge a higher tax rate for online orders?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Modeling and Database Design

Authors: Narayan S. Umanath, Richard W. Scammel

2nd edition

1285085256, 978-1285085258

More Books

Students also viewed these Databases questions

Question

How do you calculate the GDP using the expenditures formula?

Answered: 1 week ago