Lookup table containing the departments within the Adventure Works Cycles company.
Idx | Field Name | Data Type | Description |
---|---|---|---|
* | DepartmentID | smallint AUTOINCREMENT | Primary key for Department records. |
* | Name | name | Name of the department. |
* | GroupName | name | Name of the group to which the department belongs. |
* | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
Indexes | |||
PK_Department_DepartmentID | ON DepartmentID | Clustered index created by a primary key constraint. | |
AK_Department_Name | ON Name | Unique nonclustered index. |
Employee information such as salary, department, and title.
Idx | Field Name | Data Type | Description |
---|---|---|---|
* | BusinessEntityID | int | Primary key for Employee records. Foreign key to BusinessEntity.BusinessEntityID. |
* | NationalIDNumber | nvarchar(15) | Unique national identification number such as a social security number. |
* | LoginID | nvarchar(256) | Network login. |
OrganizationNode | hierarchyid | Where the employee is located in corporate hierarchy. | |
OrganizationLevel | smallint | The depth of the employee in the corporate hierarchy. | |
* | JobTitle | nvarchar(50) | Work title such as Buyer or Sales Representative. |
* | BirthDate | date | Date of birth. |
* | MaritalStatus | nchar(1) | M = Married, S = Single |
* | Gender | nchar(1) | M = Male, F = Female |
* | HireDate | date | Employee hired on this date. |
* | SalariedFlag | flag DEFAULT 1 | Job classification. 0 = Hourly, not exempt from collective bargaining. 1 = Salaried, exempt from collective bargaining. |
* | VacationHours | smallint DEFAULT 0 | Number of available vacation hours. |
* | SickLeaveHours | smallint DEFAULT 0 | Number of available sick leave hours. |
* | CurrentFlag | flag DEFAULT 1 | 0 = Inactive, 1 = Active |
* | rowguid | uniqueidentifier DEFAULT newid() | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. |
* | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
Indexes | |||
PK_Employee_BusinessEntityID | ON BusinessEntityID | Clustered index created by a primary key constraint. | |
AK_Employee_LoginID | ON LoginID | Unique nonclustered index. | |
AK_Employee_NationalIDNumber | ON NationalIDNumber | Unique nonclustered index. | |
AK_Employee_rowguid | ON rowguid | Unique nonclustered index. Used to support replication samples. | |
IX_Employee_OrganizationLevel_OrganizationNode | ON OrganizationLevel, OrganizationNode | Unique nonclustered index. | |
IX_Employee_OrganizationNode | ON OrganizationNode | Unique nonclustered index. | |
Foreign Keys | |||
FK_Employee_Person_BusinessEntityID | ( BusinessEntityID ) ref Person (BusinessEntityID) | Foreign key constraint referencing Person.BusinessEntityID. | |
Constraints | |||
CK_Employee_BirthDate | [BirthDate]>='1930-01-01' AND [BirthDate]<=dateadd(year,(-18),getdate()) | ||
CK_Employee_MaritalStatus | upper([MaritalStatus])='S' OR upper([MaritalStatus])='M' | ||
CK_Employee_Gender | upper([Gender])='F' OR upper([Gender])='M' | ||
CK_Employee_HireDate | [HireDate]>='1996-07-01' AND [HireDate]<=dateadd(day,(1),getdate()) | ||
CK_Employee_VacationHours | [VacationHours]>=(-40) AND [VacationHours]<=(240) | ||
CK_Employee_SickLeaveHours | [SickLeaveHours]>=(0) AND [SickLeaveHours]<=(120) | ||
Triggers | |||
dEmployee |
Employee department transfers.
Idx | Field Name | Data Type | Description |
---|---|---|---|
* | BusinessEntityID | int | Employee identification number. Foreign key to Employee.BusinessEntityID. |
* | StartDate | date | Date the employee started work in the department. |
* | DepartmentID | smallint | Department in which the employee worked including currently. Foreign key to Department.DepartmentID. |
* | ShiftID | tinyint | Identifies which 8-hour shift the employee works. Foreign key to Shift.Shift.ID. |
EndDate | date | Date the employee left the department. NULL = Current department. | |
* | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
Indexes | |||
PK_EmployeeDepartmentHistory_BusinessEntityID_StartDate_DepartmentID | ON BusinessEntityID, StartDate, DepartmentID, ShiftID | Clustered index created by a primary key constraint. | |
IX_EmployeeDepartmentHistory_DepartmentID | ON DepartmentID | Nonclustered index. | |
IX_EmployeeDepartmentHistory_ShiftID | ON ShiftID | Nonclustered index. | |
Foreign Keys | |||
FK_EmployeeDepartmentHistory_Department_DepartmentID | ( DepartmentID ) ref Department (DepartmentID) | Foreign key constraint referencing Department.DepartmentID. | |
FK_EmployeeDepartmentHistory_Employee_BusinessEntityID | ( BusinessEntityID ) ref Employee (BusinessEntityID) | Foreign key constraint referencing Employee.EmployeeID. | |
FK_EmployeeDepartmentHistory_Shift_ShiftID | ( ShiftID ) ref Shift (ShiftID) | Foreign key constraint referencing Shift.ShiftID | |
Constraints | |||
CK_EmployeeDepartmentHistory_EndDate | [EndDate]>=[StartDate] OR [EndDate] IS NULL | ||
CK_EmployeeDepartmentHistory_EndDate | [EndDate]>=[StartDate] OR [EndDate] IS NULL |
Employee pay history.
Idx | Field Name | Data Type | Description |
---|---|---|---|
* | BusinessEntityID | int | Employee identification number. Foreign key to Employee.BusinessEntityID. |
* | RateChangeDate | datetime | Date the change in pay is effective |
* | Rate | money | Salary hourly rate. |
* | PayFrequency | tinyint | 1 = Salary received monthly, 2 = Salary received biweekly |
* | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
Indexes | |||
PK_EmployeePayHistory_BusinessEntityID_RateChangeDate | ON BusinessEntityID, RateChangeDate | Clustered index created by a primary key constraint. | |
Foreign Keys | |||
FK_EmployeePayHistory_Employee_BusinessEntityID | ( BusinessEntityID ) ref Employee (BusinessEntityID) | Foreign key constraint referencing Employee.EmployeeID. | |
Constraints | |||
CK_EmployeePayHistory_Rate | [Rate]>=(6.50) AND [Rate]<=(200.00) | ||
CK_EmployeePayHistory_PayFrequency | [PayFrequency]=(2) OR [PayFrequency]=(1) |
Résumés submitted to Human Resources by job applicants.
Idx | Field Name | Data Type | Description |
---|---|---|---|
* | JobCandidateID | int AUTOINCREMENT | Primary key for JobCandidate records. |
BusinessEntityID | int | Employee identification number if applicant was hired. Foreign key to Employee.BusinessEntityID. | |
Resume | xml | Résumé in XML format. | |
* | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
Indexes | |||
PK_JobCandidate_JobCandidateID | ON JobCandidateID | Clustered index created by a primary key constraint. | |
IX_JobCandidate_BusinessEntityID | ON BusinessEntityID | Nonclustered index. | |
Foreign Keys | |||
FK_JobCandidate_Employee_BusinessEntityID | ( BusinessEntityID ) ref Employee (BusinessEntityID) | Foreign key constraint referencing Employee.EmployeeID. |
Work shift lookup table.
Idx | Field Name | Data Type | Description |
---|---|---|---|
* | ShiftID | tinyint AUTOINCREMENT | Primary key for Shift records. |
* | Name | name | Shift description. |
* | StartTime | time(16) | Shift start time. |
* | EndTime | time(16) | Shift end time. |
* | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
Indexes | |||
PK_Shift_ShiftID | ON ShiftID | Clustered index created by a primary key constraint. | |
AK_Shift_Name | ON Name | Unique nonclustered index. | |
AK_Shift_StartTime_EndTime | ON StartTime, EndTime | Unique nonclustered index. |