← All tables and views
AdventureWorks OLTP view
HumanResources.vEmployeeDepartmentHistory
Native view in the AdventureWorks OLTP sample database.
296rows
11 columns
Schema from the provider contract| Column | Type | Nullable | Key | References |
|---|---|---|---|---|
BusinessEntityID | | yes | — | — |
Title | | yes | — | — |
FirstName | | yes | — | — |
MiddleName | | yes | — | — |
LastName | | yes | — | — |
Suffix | | yes | — | — |
Shift | | yes | — | — |
Department | | yes | — | — |
GroupName | | yes | — | — |
StartDate | | yes | — | — |
EndDate | | yes | — | — |
View definition
CREATE VIEW "HumanResources.vEmployeeDepartmentHistory" AS
SELECT
e."BusinessEntityID"
,p."Title"
,p."FirstName"
,p."MiddleName"
,p."LastName"
,p."Suffix"
,s."Name" AS "Shift"
,d."Name" AS "Department"
,d."GroupName"
,edh."StartDate"
,edh."EndDate"
FROM "HumanResources.Employee" e
INNER JOIN "Person.Person" p
ON p."BusinessEntityID" = e."BusinessEntityID"
INNER JOIN "HumanResources.EmployeeDepartmentHistory" edh
ON e."BusinessEntityID" = edh."BusinessEntityID"
INNER JOIN "HumanResources.Department" d
ON edh."DepartmentID" = d."DepartmentID"
INNER JOIN "HumanResources.Shift" s
ON s."ShiftID" = edh."ShiftID"Data preview
Sample records
| BusinessEntityID | Title | FirstName | MiddleName | LastName | Suffix | Shift |
|---|---|---|---|---|---|---|
| 1 | NULL | Ken | J | Sánchez | NULL | Day |
| 2 | NULL | Terri | Lee | Duffy | NULL | Day |
| 3 | NULL | Roberto | NULL | Tamburello | NULL | Day |
| 4 | NULL | Rob | NULL | Walters | NULL | Day |
| 4 | NULL | Rob | NULL | Walters | NULL | Day |
| 5 | Ms. | Gail | A | Erickson | NULL | Day |
| 6 | Mr. | Jossef | H | Goldberg | NULL | Day |
| 7 | NULL | Dylan | A | Miller | NULL | Day |