HumanResources.vEmployee
Documentation | AdventureWorks |
Schema | HumanResources |
Name | vEmployee |
Module | Human Resources |
Employee names and addresses.
Columns
Key | Name | Data type | Null | Attributes | References | Description | ||
---|---|---|---|---|---|---|---|---|
1 | BusinessEntityID | int | ||||||
2 | Title | nvarchar(8) | ||||||
3 | FirstName | nvarchar(50) | ||||||
4 | MiddleName | nvarchar(50) | ||||||
5 | LastName | nvarchar(50) | ||||||
6 | Suffix | nvarchar(10) | ||||||
7 | JobTitle | nvarchar(50) | ||||||
8 | PhoneNumber | nvarchar(25) | ||||||
9 | PhoneNumberType | nvarchar(50) | ||||||
10 | EmailAddress | nvarchar(50) | ||||||
11 | EmailPromotion | int | ||||||
12 | AddressLine1 | nvarchar(60) | ||||||
13 | AddressLine2 | nvarchar(60) | ||||||
14 | City | nvarchar(30) | ||||||
15 | StateProvinceName | nvarchar(50) | ||||||
16 | PostalCode | nvarchar(15) | ||||||
17 | CountryRegionName | nvarchar(50) | ||||||
18 | AdditionalContactInfo | xml |
Uses
Script
CREATE VIEW [HumanResources].[vEmployee] AS SELECT e.[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] ,p.[AdditionalContactInfo] FROM [HumanResources].[Employee] e INNER JOIN [Person].[Person] p ON p.[BusinessEntityID] = e.[BusinessEntityID] INNER JOIN [Person].[BusinessEntityAddress] bea ON bea.[BusinessEntityID] = e.[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 [Person].[PersonPhone] pp ON pp.BusinessEntityID = p.[BusinessEntityID] LEFT OUTER JOIN [Person].[PhoneNumberType] pnt ON pp.[PhoneNumberTypeID] = pnt.[PhoneNumberTypeID] LEFT OUTER JOIN [Person].[EmailAddress] ea ON p.[BusinessEntityID] = ea.[BusinessEntityID]; |
Exported: 2019-02-04 23:13, Last imported: 2018-03-07 11:56