-
Notifications
You must be signed in to change notification settings - Fork 12
/
Workload Database File IO.sql
35 lines (25 loc) · 1.09 KB
/
Workload Database File IO.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
31
32
33
34
/* Workload for Database File I/O */
USE AdventureWorks2014;
GO
/* DANGER, WILL ROBINSON */
DBCC DROPCLEANBUFFERS;
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;
SELECT P.FirstName + ' ' + P.LastName AS SalesPerson, SP.SalesQuota, SP.SalesYTD, SP.SalesLastYear, SP.SalesYTD - SP.SalesLastYear AS YearDiff, SP.Bonus, ST.Name AS Territory
FROM Sales.SalesPerson SP
INNER JOIN Person.Person P ON P.BusinessEntityID = SP.BusinessEntityID
INNER JOIN Sales.SalesTerritory ST ON ST.TerritoryID = SP.TerritoryID;
CREATE TABLE TestForFileIO
(ID INT IDENTITY,
Superhero VARCHAR(25),
PlanetOfOrigin VARCHAR(25));
INSERT INTO TestForFileIO
VALUES ('Wonder Woman', 'Paradise Island'), ('Superman', 'Krypton'), ('Batman', 'Earth');
CHECKPOINT
DELETE FROM TestForFileIO
WHERE Superhero = 'Batman';
CHECKPOINT
--Cleanup
DROP TABLE TestForFileIO;