Remove extra spacing

This commit is contained in:
Lorin Thwaits
2023-02-20 19:33:29 +00:00
parent 434b798c98
commit b062f2c734
1461 changed files with 13333 additions and 76271 deletions
@@ -8,55 +8,55 @@ GO
-- Query 1
USE AdventureWorks2014
GO
SELECT e.[BusinessEntityID],
p.[Title],
p.[FirstName],
p.[MiddleName],
p.[LastName],
p.[Suffix],
e.[JobTitle],
pp.[PhoneNumber],
pnt.[Name] AS [PhoneNumberType],
ea.[EmailAddress],
p.[EmailPromotion],
a.[AddressLine1],
a.[AddressLine2],
a.[City],
sp.[Name] AS [StateProvinceName],
a.[PostalCode],
cr.[Name] AS [CountryRegionName],
p.[AdditionalContactInfo]
FROM [HumanResources].[Employee] AS e
INNER JOIN [Person].[Person] AS p
ON RTRIM(LTRIM(p.[BusinessEntityID])) = RTRIM(LTRIM(e.[BusinessEntityID]))
INNER JOIN [Person].[BusinessEntityAddress] AS bea
ON RTRIM(LTRIM(bea.[BusinessEntityID])) = RTRIM(LTRIM(e.[BusinessEntityID]))
INNER JOIN [Person].[Address] AS a
ON RTRIM(LTRIM(a.[AddressID])) = RTRIM(LTRIM(bea.[AddressID]))
INNER JOIN [Person].[StateProvince] AS sp
ON RTRIM(LTRIM(sp.[StateProvinceID])) = RTRIM(LTRIM(a.[StateProvinceID]))
INNER JOIN [Person].[CountryRegion] AS cr
ON RTRIM(LTRIM(cr.[CountryRegionCode])) = RTRIM(LTRIM(sp.[CountryRegionCode]))
LEFT OUTER JOIN [Person].[PersonPhone] AS pp
ON RTRIM(LTRIM(pp.BusinessEntityID)) = RTRIM(LTRIM(p.[BusinessEntityID]))
LEFT OUTER JOIN [Person].[PhoneNumberType] AS pnt
ON RTRIM(LTRIM(pp.[PhoneNumberTypeID])) = RTRIM(LTRIM(pnt.[PhoneNumberTypeID]))
LEFT OUTER JOIN [Person].[EmailAddress] AS ea
SELECT e.[BusinessEntityID],
p.[Title],
p.[FirstName],
p.[MiddleName],
p.[LastName],
p.[Suffix],
e.[JobTitle],
pp.[PhoneNumber],
pnt.[Name] AS [PhoneNumberType],
ea.[EmailAddress],
p.[EmailPromotion],
a.[AddressLine1],
a.[AddressLine2],
a.[City],
sp.[Name] AS [StateProvinceName],
a.[PostalCode],
cr.[Name] AS [CountryRegionName],
p.[AdditionalContactInfo]
FROM [HumanResources].[Employee] AS e
INNER JOIN [Person].[Person] AS p
ON RTRIM(LTRIM(p.[BusinessEntityID])) = RTRIM(LTRIM(e.[BusinessEntityID]))
INNER JOIN [Person].[BusinessEntityAddress] AS bea
ON RTRIM(LTRIM(bea.[BusinessEntityID])) = RTRIM(LTRIM(e.[BusinessEntityID]))
INNER JOIN [Person].[Address] AS a
ON RTRIM(LTRIM(a.[AddressID])) = RTRIM(LTRIM(bea.[AddressID]))
INNER JOIN [Person].[StateProvince] AS sp
ON RTRIM(LTRIM(sp.[StateProvinceID])) = RTRIM(LTRIM(a.[StateProvinceID]))
INNER JOIN [Person].[CountryRegion] AS cr
ON RTRIM(LTRIM(cr.[CountryRegionCode])) = RTRIM(LTRIM(sp.[CountryRegionCode]))
LEFT OUTER JOIN [Person].[PersonPhone] AS pp
ON RTRIM(LTRIM(pp.BusinessEntityID)) = RTRIM(LTRIM(p.[BusinessEntityID]))
LEFT OUTER JOIN [Person].[PhoneNumberType] AS pnt
ON RTRIM(LTRIM(pp.[PhoneNumberTypeID])) = RTRIM(LTRIM(pnt.[PhoneNumberTypeID]))
LEFT OUTER JOIN [Person].[EmailAddress] AS ea
ON RTRIM(LTRIM(p.[BusinessEntityID])) = RTRIM(LTRIM(ea.[BusinessEntityID]))
OPTION (QUERYTRACEON 9481)
GO
GO
-- Query 2
USE AdventureWorks2014;
GO
DBCC DROPCLEANBUFFERS;
GO
;WITH Prices AS (
SELECT dbo.ufnGetProductDealerPrice(d.ProductID, h.OrderDate) AS Price,
USE AdventureWorks2014;
GO
DBCC DROPCLEANBUFFERS;
GO
;WITH Prices AS (
SELECT dbo.ufnGetProductDealerPrice(d.ProductID, h.OrderDate) AS Price,
ROW_NUMBER() over(ORDER BY p.MiddleNAme) rn, p.PersonType, pr.Color
FROM Sales.SalesOrderDetail AS d
INNER JOIN Sales.SalesOrderHeader AS h ON h.SalesOrderID = d.SalesOrderID
INNER JOIN Person.Person AS p ON h.CustomerID = p.BusinessEntityID
INNER JOIN Production.Product AS pr ON d.ProductID = pr.ProductID
) SELECT * FROM Prices;
FROM Sales.SalesOrderDetail AS d
INNER JOIN Sales.SalesOrderHeader AS h ON h.SalesOrderID = d.SalesOrderID
INNER JOIN Person.Person AS p ON h.CustomerID = p.BusinessEntityID
INNER JOIN Production.Product AS pr ON d.ProductID = pr.ProductID
) SELECT * FROM Prices;
GO
@@ -7,55 +7,55 @@ GO
-- Query 1
USE AdventureWorks2014
GO
SELECT e.[BusinessEntityID],
p.[Title],
p.[FirstName],
p.[MiddleName],
p.[LastName],
p.[Suffix],
e.[JobTitle],
pp.[PhoneNumber],
pnt.[Name] AS [PhoneNumberType],
ea.[EmailAddress],
p.[EmailPromotion],
a.[AddressLine1],
a.[AddressLine2],
a.[City],
sp.[Name] AS [StateProvinceName],
a.[PostalCode],
cr.[Name] AS [CountryRegionName],
p.[AdditionalContactInfo]
FROM [HumanResources].[Employee] AS e
INNER JOIN [Person].[Person] AS p
ON RTRIM(LTRIM(p.[BusinessEntityID])) = RTRIM(LTRIM(e.[BusinessEntityID]))
INNER JOIN [Person].[BusinessEntityAddress] AS bea
ON RTRIM(LTRIM(bea.[BusinessEntityID])) = RTRIM(LTRIM(e.[BusinessEntityID]))
INNER JOIN [Person].[Address] AS a
ON RTRIM(LTRIM(a.[AddressID])) = RTRIM(LTRIM(bea.[AddressID]))
INNER JOIN [Person].[StateProvince] AS sp
ON RTRIM(LTRIM(sp.[StateProvinceID])) = RTRIM(LTRIM(a.[StateProvinceID]))
INNER JOIN [Person].[CountryRegion] AS cr
ON RTRIM(LTRIM(cr.[CountryRegionCode])) = RTRIM(LTRIM(sp.[CountryRegionCode]))
LEFT OUTER JOIN [Person].[PersonPhone] AS pp
ON RTRIM(LTRIM(pp.BusinessEntityID)) = RTRIM(LTRIM(p.[BusinessEntityID]))
LEFT OUTER JOIN [Person].[PhoneNumberType] AS pnt
ON RTRIM(LTRIM(pp.[PhoneNumberTypeID])) = RTRIM(LTRIM(pnt.[PhoneNumberTypeID]))
LEFT OUTER JOIN [Person].[EmailAddress] AS ea
SELECT e.[BusinessEntityID],
p.[Title],
p.[FirstName],
p.[MiddleName],
p.[LastName],
p.[Suffix],
e.[JobTitle],
pp.[PhoneNumber],
pnt.[Name] AS [PhoneNumberType],
ea.[EmailAddress],
p.[EmailPromotion],
a.[AddressLine1],
a.[AddressLine2],
a.[City],
sp.[Name] AS [StateProvinceName],
a.[PostalCode],
cr.[Name] AS [CountryRegionName],
p.[AdditionalContactInfo]
FROM [HumanResources].[Employee] AS e
INNER JOIN [Person].[Person] AS p
ON RTRIM(LTRIM(p.[BusinessEntityID])) = RTRIM(LTRIM(e.[BusinessEntityID]))
INNER JOIN [Person].[BusinessEntityAddress] AS bea
ON RTRIM(LTRIM(bea.[BusinessEntityID])) = RTRIM(LTRIM(e.[BusinessEntityID]))
INNER JOIN [Person].[Address] AS a
ON RTRIM(LTRIM(a.[AddressID])) = RTRIM(LTRIM(bea.[AddressID]))
INNER JOIN [Person].[StateProvince] AS sp
ON RTRIM(LTRIM(sp.[StateProvinceID])) = RTRIM(LTRIM(a.[StateProvinceID]))
INNER JOIN [Person].[CountryRegion] AS cr
ON RTRIM(LTRIM(cr.[CountryRegionCode])) = RTRIM(LTRIM(sp.[CountryRegionCode]))
LEFT OUTER JOIN [Person].[PersonPhone] AS pp
ON RTRIM(LTRIM(pp.BusinessEntityID)) = RTRIM(LTRIM(p.[BusinessEntityID]))
LEFT OUTER JOIN [Person].[PhoneNumberType] AS pnt
ON RTRIM(LTRIM(pp.[PhoneNumberTypeID])) = RTRIM(LTRIM(pnt.[PhoneNumberTypeID]))
LEFT OUTER JOIN [Person].[EmailAddress] AS ea
ON RTRIM(LTRIM(p.[BusinessEntityID])) = RTRIM(LTRIM(ea.[BusinessEntityID]))
OPTION (QUERYTRACEON 9481)
GO
GO
-- Query 2
USE AdventureWorks2014;
GO
DBCC DROPCLEANBUFFERS;
GO
;WITH Prices AS (
SELECT dbo.ufnGetProductDealerPrice(d.ProductID, h.OrderDate) AS Price,
USE AdventureWorks2014;
GO
DBCC DROPCLEANBUFFERS;
GO
;WITH Prices AS (
SELECT dbo.ufnGetProductDealerPrice(d.ProductID, h.OrderDate) AS Price,
ROW_NUMBER() over(ORDER BY p.MiddleNAme) rn, p.PersonType, pr.Color
FROM Sales.SalesOrderDetail AS d
INNER JOIN Sales.SalesOrderHeader AS h ON h.SalesOrderID = d.SalesOrderID
INNER JOIN Person.Person AS p ON h.CustomerID = p.BusinessEntityID
INNER JOIN Production.Product AS pr ON d.ProductID = pr.ProductID
) SELECT * FROM Prices;
FROM Sales.SalesOrderDetail AS d
INNER JOIN Sales.SalesOrderHeader AS h ON h.SalesOrderID = d.SalesOrderID
INNER JOIN Person.Person AS p ON h.CustomerID = p.BusinessEntityID
INNER JOIN Production.Product AS pr ON d.ProductID = pr.ProductID
) SELECT * FROM Prices;
GO
+1 -1
View File
@@ -1,2 +1,2 @@
Each file has instructions as comments on how to run the demo. Please mind the USE clauses.
Each file has instructions as comments on how to run the demo. Please mind the USE clauses.
If a specific DB is needed other than AdventureworksXXXX, then you will find the Setup script in the same folder.