← All tables and views
AdventureWorks OLTP view
Sales.vStoreWithContacts
Native view in the AdventureWorks OLTP sample database.
753rows
12 columns
Schema from the provider contract| Column | Type | Nullable | Key | References |
|---|---|---|---|---|
BusinessEntityID | | yes | — | — |
Name | | yes | — | — |
ContactType | | yes | — | — |
Title | | yes | — | — |
FirstName | | yes | — | — |
MiddleName | | yes | — | — |
LastName | | yes | — | — |
Suffix | | yes | — | — |
PhoneNumber | | yes | — | — |
PhoneNumberType | | yes | — | — |
EmailAddress | | yes | — | — |
EmailPromotion | | yes | — | — |
View definition
CREATE VIEW "Sales.vStoreWithContacts" AS
SELECT
s."BusinessEntityID"
,s."Name"
,ct."Name" AS "ContactType"
,p."Title"
,p."FirstName"
,p."MiddleName"
,p."LastName"
,p."Suffix"
,pp."PhoneNumber"
,pnt."Name" AS "PhoneNumberType"
,ea."EmailAddress"
,p."EmailPromotion"
FROM "Sales.Store" s
INNER JOIN "Person.BusinessEntityContact" bec
ON bec."BusinessEntityID" = s."BusinessEntityID"
INNER JOIN "Person.ContactType" ct
ON ct."ContactTypeID" = bec."ContactTypeID"
INNER JOIN "Person.Person" p
ON p."BusinessEntityID" = bec."PersonID"
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 | Name | ContactType | Title | FirstName | MiddleName | LastName |
|---|---|---|---|---|---|---|
| 292 | Next-Door Bike Store | Owner | Mr. | Gustavo | NULL | Achong |
| 294 | Professional Sales and Service | Owner | Ms. | Catherine | R. | Abel |
| 296 | Riders Company | Owner | Ms. | Kim | NULL | Abercrombie |
| 298 | The Bike Mechanics | Owner | Sr. | Humberto | NULL | Acevedo |
| 300 | Nationwide Supply | Owner | Sra. | Pilar | NULL | Ackerman |
| 302 | Area Bike Accessories | Owner | Ms. | Frances | B. | Adams |
| 304 | Bicycle Accessories and Kits | Owner | Ms. | Margaret | J. | Smith |
| 306 | Clamps & Brackets Co. | Owner | Ms. | Carla | J. | Adams |