← 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| Column | Type | Nullable | Key | References |
|---|---|---|---|---|
BusinessEntityID | | yes | — | — |
Title | | yes | — | — |
FirstName | | yes | — | — |
MiddleName | | yes | — | — |
LastName | | yes | — | — |
Suffix | | yes | — | — |
PhoneNumber | | yes | — | — |
PhoneNumberType | | yes | — | — |
EmailAddress | | yes | — | — |
EmailPromotion | | yes | — | — |
AddressType | | yes | — | — |
AddressLine1 | | yes | — | — |
AddressLine2 | | yes | — | — |
City | | yes | — | — |
StateProvinceName | | yes | — | — |
PostalCode | | yes | — | — |
CountryRegionName | | yes | — | — |
Demographics | | yes | — | — |
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 NULLData preview
Sample records
| BusinessEntityID | Title | FirstName | MiddleName | LastName | Suffix | PhoneNumber |
|---|---|---|---|---|---|---|
| 1699 | Mr. | David | R. | Robinett | NULL | 238-555-0100 |
| 1700 | Ms. | Rebecca | A. | Robinson | NULL | 648-555-0100 |
| 1701 | Ms. | Dorothy | B. | Robinson | NULL | 423-555-0100 |
| 1702 | Ms. | Carol Ann | F. | Rockne | NULL | 439-555-0100 |
| 1703 | Mr. | Scott | M. | Rodgers | NULL | 989-555-0100 |
| 1704 | Mr. | Jim | NULL | Rodman | NULL | 899-555-0100 |
| 1705 | Mr. | Eric | NULL | Rothenberg | NULL | 326-555-0100 |
| 1706 | Mr. | Michael | L. | Rothkugel | NULL | 358-555-0100 |