Northwind Database (Document! X Sample)
AdventureWorks Database / HumanResources Schema / HumanResources.vEmployee View
In This Topic
    HumanResources.vEmployee View
    In This Topic
    Description
    Employee names and addresses.
    Properties
    Creation Date27/10/2017 14:33
    Is Schema Bound
    Encrypted
    Ansi Nulls
    Columns
     Column NameDescriptionDatatypeLengthAllow NullsDefaultFormula
      Integer4   
      VarWChar8  
      dbo.Name50   
      dbo.Name50  
      dbo.Name50   
      VarWChar10  
      VarWChar50   
      dbo.Phone25  
      dbo.Name50  
      VarWChar50  
      Integer4   
      VarWChar60   
      VarWChar60  
      VarWChar30   
      dbo.Name50   
      VarWChar15   
      dbo.Name50   
      1410  
    Objects that HumanResources.vEmployee depends on
     Database ObjectObject TypeDescriptionDep Level
    Person.Address tablePerson.AddressTableStreet address information for customers, employees, and vendors.1
    Person.AddressType tablePerson.AddressTypeTableTypes of addresses stored in the Address table. 1
    Person.BusinessEntity tablePerson.BusinessEntityTableSource of the ID that connects vendors, customers, and employees with address and contact information.2
    Person.BusinessEntityAddress tablePerson.BusinessEntityAddressTableCross-reference table mapping customers, vendors, and employees to their addresses.1
    Person.CountryRegion tablePerson.CountryRegionTableLookup table containing the ISO standard codes for countries and regions.4
    Person.EmailAddress tablePerson.EmailAddressTableWhere to send a person email.1
    HumanResources.Employee tableHumanResources.EmployeeTableEmployee information such as salary, department, and title.3
    dbo.Flag datatypedbo.FlagUser Defined Data Type 4
    dbo.NameStyle datatypedbo.NameStyleUser Defined Data Type 5
    Person.Person tablePerson.PersonTableHuman beings involved with AdventureWorks: employees, customer contacts, and vendor contacts.4
    Person.PersonPhone tablePerson.PersonPhoneTableTelephone number and type of a person.1
    dbo.Phone datatypedbo.PhoneUser Defined Data Type 2
    Person.PhoneNumberType tablePerson.PhoneNumberTypeTableType of phone number of a person.1
    Sales.SalesTerritory tableSales.SalesTerritoryTableSales territory lookup table.3
    Person.StateProvince tablePerson.StateProvinceTableState and province lookup table.1
    View Definition
    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];
    
    See Also