← 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
ColumnTypeNullableKeyReferences
BusinessEntityIDyes——
Titleyes——
FirstNameyes——
MiddleNameyes——
LastNameyes——
Suffixyes——
JobTitleyes——
PhoneNumberyes——
PhoneNumberTypeyes——
EmailAddressyes——
EmailPromotionyes——
AddressLine1yes——
AddressLine2yes——
Cityyes——
StateProvinceNameyes——
PostalCodeyes——
CountryRegionNameyes——
TerritoryNameyes——
TerritoryGroupyes——
SalesQuotayes——
SalesYTDyes——
SalesLastYearyes——

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

17 rows available
BusinessEntityIDTitleFirstNameMiddleNameLastNameSuffixJobTitle
274NULLStephenYJiangNULLNorth American Sales Manager
275NULLMichaelGBlytheNULLSales Representative
276NULLLindaCMitchellNULLSales Representative
277NULLJillianNULLCarsonNULLSales Representative
278NULLGarrettRVargasNULLSales Representative
279NULLTsviMichaelReiterNULLSales Representative
280NULLPamelaOAnsman-WolfeNULLSales Representative
281NULLShuKItoNULLSales Representative