-
Notifications
You must be signed in to change notification settings - Fork 12
/
Workload Capture Queries and Resources.sql
30 lines (21 loc) · 1.21 KB
/
Workload Capture Queries and Resources.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* Workload for 'Capture queries and resources' */
USE AdventureWorks2016;
GO
EXEC [dbo].[uspGetManagerEmployees] 5 ;
SELECT SOH.SalesOrderID, SOH.OrderDate, SOD.ProductID, SOD.OrderQty, SOD.UnitPrice, SOD.UnitPriceDiscount
FROM Sales.SalesOrderHeader SOH
INNER JOIN Sales.SalesOrderDetail SOD ON SOD.SalesOrderID = SOH.SalesOrderID;
EXEC [dbo].[uspGetManagerEmployees] 44
SELECT SOH.SalesOrderID, SOH.OrderDate, SOD.ProductID, SOD.OrderQty, SOD.UnitPrice, SOD.UnitPriceDiscount
FROM Sales.SalesOrderHeader SOH
INNER JOIN Sales.SalesOrderDetail SOD ON SOD.SalesOrderID = SOH.SalesOrderID
WHERE SOD.ProductID = 756;
EXEC [dbo].[uspGetManagerEmployees] 55
SELECT SOD.ProductID, SUM(SOD.OrderQty) AS Total_Qty, SUM(SOD.UnitPrice) AS Total_Price, SUM(SOD.UnitPriceDiscount) AS Total_Discount
FROM Sales.SalesOrderHeader SOH
INNER JOIN Sales.SalesOrderDetail SOD ON SOD.SalesOrderID = SOH.SalesOrderID
GROUP BY SOD.ProductID;
SELECT SOH.CustomerID, SOD.ProductID, SUM(SOD.OrderQty) AS Total_Qty, SUM(SOD.UnitPrice) AS Total_Price, SUM(SOD.UnitPriceDiscount) AS Total_Discount
FROM Sales.SalesOrderHeader SOH
INNER JOIN Sales.SalesOrderDetail SOD ON SOD.SalesOrderID = SOH.SalesOrderID
GROUP BY SOH.CustomerID, SOD.ProductID;