AdventureWorks2019
HumanResources.EmployeeDepartmentHistory
//
Employee department transfers.
Created: Modified:
Columns
-
//${escapify(column.description)}[int] NOT NULL
-
//${escapify(column.description)}[smallint] NOT NULL
-
//${escapify(column.description)}[tinyint] NOT NULL
-
//${escapify(column.description)}[date] NOT NULL
-
//${escapify(column.description)}[date] NULL
-
//${escapify(column.description)}[datetime] NOT NULL DEFAULT (getdate())
Indexes
-
//Clustered index created by a primary key constraint.PK_EmployeeDepartmentHistory_BusinessEntityID_StartDate_DepartmentIDUNIQUE CLUSTEREDBusinessEntityID , DepartmentID , ShiftID , StartDate
-
//Nonclustered index.IX_EmployeeDepartmentHistory_DepartmentIDNONCLUSTEREDDepartmentID
-
//Nonclustered index.IX_EmployeeDepartmentHistory_ShiftIDNONCLUSTEREDShiftID
Foreign Keys
-
//Foreign key constraint referencing Department.DepartmentID.FK_EmployeeDepartmentHistory_Department_DepartmentIDHumanResources.DepartmentDepartmentID ⥱ DepartmentID
-
//Foreign key constraint referencing Employee.EmployeeID.FK_EmployeeDepartmentHistory_Employee_BusinessEntityIDHumanResources.EmployeeBusinessEntityID ⥱ BusinessEntityID
-
//Foreign key constraint referencing Shift.ShiftIDFK_EmployeeDepartmentHistory_Shift_ShiftIDHumanResources.ShiftShiftID ⥱ ShiftID
Check Constraints
-
//Check constraint [EndDate] >= [StartDate] OR [EndDate] IS NULCK_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