Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help writing an sql query with these tables for the tabular report Production.ProductCategory Production.ProductSubcategory Production.Product Sales.SalesOrderHeader Sales.SalesOrderDetails An example of what the Query

I need help writing an sql query with these tables for the tabular report

Production.ProductCategory

Production.ProductSubcategory

Production.Product

Sales.SalesOrderHeader

Sales.SalesOrderDetails

An example of what the Query should look like: SELECT YEAR(OrderDate) AS OrderYear, C.CustomerID, SUM(TotalDue) AS Sales, T.TerritoryID, T.Name AS Territory, s.Name AS Store FROM sales.SalesOrderHeader AS SOH JOIN Sales.SalesTerritory AS T ON SOH.TerritoryID = T.TerritoryID JOIN Sales.Customer AS C ON SOH.CustomerID = C.CustomerID JOIN Sales.Store AS S ON S.BusinessEntityID = C.StoreID GROUP BY C.CustomerID, T.TerritoryID, T.Name, YEAR(OrderDate), S.Name;

image text in transcribed

image text in transcribed

image text in transcribed

Use database AdventureWorks2019 to generate the following reports: 1. Sales by Year Tabular 2. Category Sales by Year Matrix Instructions Part 1: You work for Adventure Works, a bicycle and accessories company. Your boss would like to have a report for "Sales by Year". They want a pdf as a final product that will print out nicely for the attendees of an upcoming meeting and yearly sales review. Further discussion with your boss of the report leads to the following list of requirements: - Page Header: with Report Title and author name - Page Footer: with execution time and page numbering - Static Headers / Footers - OrderYear - descending - Category - ascending - Subcategory - ascending - Sales - descending - Grand Total - Color Coding - Landscape Print Format Considering this, you decide to create a tabular report using the following tables: - ProductCategory - ProductSubcategory - Product - SalesOrderHeader - SalesOrderDetails (Sales is "LineTotal" from SalesOrderDetails) (Your resulting pdf report should resemble:) Example first page: Example first page: Sales By Year 629re0e2 926009FM Example middle page: 4/29/2022 92009PM Example last page: Instructions Part 2: You work for Adventure Works, a bicycle and accessories company. Your boss would also like to have a report in matrix format, showing "Category Sales by Year" in an excel file for use in their presentation to the meeting attendees. Using the same tables from the first report, you build a concise matrix report. Category Sales By Year Matrix Auther: Mindy Knevules (Total is "LineTotal" from SalesOrderDetails)

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

Database Design Application Development And Administration

Authors: Michael V. Mannino

3rd Edition

0071107010, 978-0071107013

More Books

Students also viewed these Databases questions