← All tables and views
AdventureWorks OLTP view
Purchasing.vVendorWithContacts
Native view in the AdventureWorks OLTP sample database.
156rows
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 "Purchasing.vVendorWithContacts" AS
SELECT
v."BusinessEntityID"
,v."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 "Purchasing.Vendor" v
INNER JOIN "Person.BusinessEntityContact" bec
ON bec."BusinessEntityID" = v."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 |
|---|---|---|---|---|---|---|
| 1492 | Australia Bike Retailer | Sales Agent | Ms. | Jo | J. | Zimmerman |
| 1492 | Australia Bike Retailer | Sales Associate | Ms. | Paula | B. | Moberly |
| 1492 | Australia Bike Retailer | Sales Manager | Ms. | Charlene | J. | Wojcik |
| 1494 | Allenson Cycles | Sales Agent | Ms. | Suchitra | NULL | Mohan |
| 1494 | Allenson Cycles | Sales Associate | Mr. | Michiel | NULL | Wories |
| 1496 | Advanced Bicycles | Sales Agent | Mr. | Eugene | NULL | Zabokritski |
| 1496 | Advanced Bicycles | Sales Associate | Mr. | Jonathan | NULL | Moeller |
| 1496 | Advanced Bicycles | Sales Manager | Mr. | James | C. | Wilson |