Databases > AdventureWorks2019 > Tables > HumanResources.EmployeeDepartmentHistory

AdventureWorks2019

HumanResources.EmployeeDepartmentHistory

//
Employee department transfers.

Created: Modified:

Columns

  • //
    ${escapify(column.description)}
    BusinessEntityID
    [int] NOT NULL
  • //
    ${escapify(column.description)}
    DepartmentID
    [smallint] NOT NULL
  • //
    ${escapify(column.description)}
    ShiftID
    [tinyint] NOT NULL
  • //
    ${escapify(column.description)}
    StartDate
    [date] NOT NULL
  • //
    ${escapify(column.description)}
    EndDate
    [date] NULL
  • //
    ${escapify(column.description)}
    ModifiedDate
    [datetime] NOT NULL DEFAULT (getdate())

Indexes

  • //
    Clustered index created by a primary key constraint.
    PK_EmployeeDepartmentHistory_BusinessEntityID_StartDate_DepartmentID
    UNIQUE CLUSTERED
    BusinessEntityID , DepartmentID , ShiftID , StartDate
  • //
    Nonclustered index.
    IX_EmployeeDepartmentHistory_DepartmentID
    NONCLUSTERED
    DepartmentID
  • //
    Nonclustered index.
    IX_EmployeeDepartmentHistory_ShiftID
    NONCLUSTERED
    ShiftID

Foreign Keys

  • //
    Foreign key constraint referencing Department.DepartmentID.
    FK_EmployeeDepartmentHistory_Department_DepartmentID
    HumanResources.Department
    DepartmentID ⥱ DepartmentID
  • //
    Foreign key constraint referencing Employee.EmployeeID.
    FK_EmployeeDepartmentHistory_Employee_BusinessEntityID
    HumanResources.Employee
    BusinessEntityID ⥱ BusinessEntityID
  • //
    Foreign key constraint referencing Shift.ShiftID
    FK_EmployeeDepartmentHistory_Shift_ShiftID
    HumanResources.Shift
    ShiftID ⥱ ShiftID

Check Constraints

  • //
    Check constraint [EndDate] >= [StartDate] OR [EndDate] IS NUL
    CK_EmployeeDepartmentHistory_EndDate
    ([EndDate]>=[StartDate] OR [EndDate] IS NULL)

Sample Data

BusinessEntityID
DepartmentID
ShiftID
StartDate
EndDate
ModifiedDate
1
16
1
NULL
2
1
1
NULL
3
1
1
NULL
4
1
1
4
2
1
NULL
5
1
1
NULL
6
1
1
NULL
7
6
1
NULL
8
6
1
NULL
9
6
1
NULL
10
6
1
NULL
11
2
1
NULL
12
2
1
NULL
13
2
1
NULL
14
1
1
NULL
15
1
1
NULL
16
5
1
16
4
1
NULL
17
4
1
NULL
18
4
1
NULL
19
4
1
NULL
20
4
1
NULL
21
4
1
NULL
22
4
1
NULL
23
4
1
NULL