← All tables and views

AdventureWorks OLTP view

Sales.vIndividualCustomer

Native view in the AdventureWorks OLTP sample database.

18,508rows

18 columns

Schema from the provider contract
ColumnTypeNullableKeyReferences
BusinessEntityIDyes——
Titleyes——
FirstNameyes——
MiddleNameyes——
LastNameyes——
Suffixyes——
PhoneNumberyes——
PhoneNumberTypeyes——
EmailAddressyes——
EmailPromotionyes——
AddressTypeyes——
AddressLine1yes——
AddressLine2yes——
Cityyes——
StateProvinceNameyes——
PostalCodeyes——
CountryRegionNameyes——
Demographicsyes——

View definition

CREATE VIEW "Sales.vIndividualCustomer" AS
SELECT
    p."BusinessEntityID"
    ,p."Title"
    ,p."FirstName"
    ,p."MiddleName"
    ,p."LastName"
    ,p."Suffix"
    ,pp."PhoneNumber"
	,pnt."Name" AS "PhoneNumberType"
    ,ea."EmailAddress"
    ,p."EmailPromotion"
    ,at."Name" AS "AddressType"
    ,a."AddressLine1"
    ,a."AddressLine2"
    ,a."City"
    , sp."Name" AS "StateProvinceName"
    ,a."PostalCode"
    , cr."Name" AS "CountryRegionName"
    ,p."Demographics"
FROM "Person.Person" p
    INNER JOIN "Person.BusinessEntityAddress" bea
    ON bea."BusinessEntityID" = p."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"
    INNER JOIN "Person.AddressType" at
    ON at."AddressTypeID" = bea."AddressTypeID"
	INNER JOIN "Sales.Customer" c
	ON c."PersonID" = p."BusinessEntityID"
	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"
WHERE c.StoreID IS NULL

Data preview

Sample records

18,508 rows available
BusinessEntityIDTitleFirstNameMiddleNameLastNameSuffixPhoneNumber
1699Mr.DavidR.RobinettNULL238-555-0100
1700Ms.RebeccaA.RobinsonNULL648-555-0100
1701Ms.DorothyB.RobinsonNULL423-555-0100
1702Ms.Carol AnnF.RockneNULL439-555-0100
1703Mr.ScottM.RodgersNULL989-555-0100
1704Mr.JimNULLRodmanNULL899-555-0100
1705Mr.EricNULLRothenbergNULL326-555-0100
1706Mr.MichaelL.RothkugelNULL358-555-0100