← All tables and views
AdventureWorks OLTP view
Sales.vSalesPerson
Native view in the AdventureWorks OLTP sample database.
17rows
22 columns
Schema from the provider contract| Column | Type | Nullable | Key | References |
|---|---|---|---|---|
BusinessEntityID | | yes | — | — |
Title | | yes | — | — |
FirstName | | yes | — | — |
MiddleName | | yes | — | — |
LastName | | yes | — | — |
Suffix | | yes | — | — |
JobTitle | | yes | — | — |
PhoneNumber | | yes | — | — |
PhoneNumberType | | yes | — | — |
EmailAddress | | yes | — | — |
EmailPromotion | | yes | — | — |
AddressLine1 | | yes | — | — |
AddressLine2 | | yes | — | — |
City | | yes | — | — |
StateProvinceName | | yes | — | — |
PostalCode | | yes | — | — |
CountryRegionName | | yes | — | — |
TerritoryName | | yes | — | — |
TerritoryGroup | | yes | — | — |
SalesQuota | | yes | — | — |
SalesYTD | | yes | — | — |
SalesLastYear | | yes | — | — |
View definition
CREATE VIEW "Sales.vSalesPerson" AS
SELECT
s."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"
, st."Name" AS "TerritoryName"
, st."Group" AS "TerritoryGroup"
,s."SalesQuota"
,s."SalesYTD"
,s."SalesLastYear"
FROM "Sales.SalesPerson" s
INNER JOIN "HumanResources.Employee" e
ON e."BusinessEntityID" = s."BusinessEntityID"
INNER JOIN "Person.Person" p
ON p."BusinessEntityID" = s."BusinessEntityID"
INNER JOIN "Person.BusinessEntityAddress" bea
ON bea."BusinessEntityID" = s."BusinessEntityID"
INNER JOIN "Person.Address" a
ON a."AddressID" = bea."AddressID"
INNER JOIN "Person.StateProvince" sp
ON sp."StateProvinceID" = a."StateProvinceID"
INNER JOIN "Person.CountryRegion" cr
ON cr."CountryRegionCode" = sp."CountryRegionCode"
LEFT OUTER JOIN "Sales.SalesTerritory" st
ON st."TerritoryID" = s."TerritoryID"
LEFT OUTER JOIN "Person.EmailAddress" ea
ON ea."BusinessEntityID" = p."BusinessEntityID"
LEFT OUTER JOIN "Person.PersonPhone" pp
ON pp."BusinessEntityID" = p."BusinessEntityID"
LEFT OUTER JOIN "Person.PhoneNumberType" pnt
ON pnt."PhoneNumberTypeID" = pp."PhoneNumberTypeID"Data preview
Sample records
| BusinessEntityID | Title | FirstName | MiddleName | LastName | Suffix | JobTitle |
|---|---|---|---|---|---|---|
| 274 | NULL | Stephen | Y | Jiang | NULL | North American Sales Manager |
| 275 | NULL | Michael | G | Blythe | NULL | Sales Representative |
| 276 | NULL | Linda | C | Mitchell | NULL | Sales Representative |
| 277 | NULL | Jillian | NULL | Carson | NULL | Sales Representative |
| 278 | NULL | Garrett | R | Vargas | NULL | Sales Representative |
| 279 | NULL | Tsvi | Michael | Reiter | NULL | Sales Representative |
| 280 | NULL | Pamela | O | Ansman-Wolfe | NULL | Sales Representative |
| 281 | NULL | Shu | K | Ito | NULL | Sales Representative |