Database reference - AdventureWorks

AdventureWorks -  tables -  [HumanResources].[EmployeePayHistory]

Description

Employee pay history. 

Table properties

namevalue
name[HumanResources].[EmployeePayHistory]
createdMar 19 2009 9:08PM
modifiedMar 19 2009 9:08PM 
ansi nullson 
quoted identifieron 
row count316
Size of data16 kb
Size of indexes16 kb
Maximum size of a single row29 bytes

Columns

columndatatypelengthbytesdefaultnullsPKFKUQcomputedcomment
EmployeeIDint104 no  composite PK  Employee.EmployeeID      no  Employee identification number. Foreign key to Employee.EmployeeID. 
RateChangeDatedatetime238 no  composite PK    no  Date the change in pay is effective 
Ratemoney198 no      no  Salary hourly rate. 
PayFrequencytinyint31 no      no  1 = Salary received monthly, 2 = Salary received biweekly 
ModifiedDatedatetime238(getdate())no      no  Date and time the record was last updated. 

Indexes

namedescriptioncolumncomment
PK_EmployeePayHistory_EmployeeID_RateChangeDateclustered, unique, primary key located on PRIMARYEmployeeID, RateChangeDateClustered index created by a primary key constraint. 

References

name
Employee

Foreign key graph

EmployeeEmployeePayHistory

Foreign keys

namecolumnsforeign columnstypecomment
FK_EmployeePayHistory_Employee_EmployeeIDEmployeeIDEmployee.EmployeeID   Foreign key constraint referencing Employee.EmployeeID. 

Check constraints

namecolumncomment
CK_EmployeePayHistory_PayFrequencyPayFrequency    Check constraint [PayFrequency]=(3) OR [PayFrequency]=(2) OR [PayFrequency]=(1) 
CK_EmployeePayHistory_RateRate    Check constraint [Rate] >= (6.50) AND [Rate] <= (200.00) 

Defaults

default namecolumncomment
DF_EmployeePayHistory_ModifiedDateModifiedDateDefault constraint value of GETDATE() 

Dependency graph

DF_EmployeePayHistory_ModifiedDate...EmployeePayHistoryCK_EmployeePayHistory_PayFrequency...CK_EmployeePayHistory_RatePK_EmployeePayHistory_EmployeeID_RateChangeDate...uspUpdateEmployeeHireInfo

Objects that depend on [HumanResources].[EmployeePayHistory]

nameobject typelevel
uspUpdateEmployeeHireInfostored procedure1

Sample rows

EmployeeIDRateChangeDateRatePayFrequencyModifiedDate
7/31/1996 12:00:00 AM  12.4500  7/31/2004 12:00:00 AM 
2/26/1997 12:00:00 AM  13.4615  7/31/2004 12:00:00 AM 
12/12/1997 12:00:00 AM  43.2692  7/31/2004 12:00:00 AM 
1/5/1998 12:00:00 AM  8.6200  12/22/1997 12:00:00 AM 
7/1/2000 12:00:00 AM  23.7200  6/16/2000 12:00:00 AM 
1/15/2002 12:00:00 AM  29.8462  1/1/2002 12:00:00 AM 
1/11/1998 12:00:00 AM  25.0000  7/31/2004 12:00:00 AM 
1/20/1998 12:00:00 AM  24.0000  1/6/1998 12:00:00 AM 
8/16/1999 12:00:00 AM  28.7500  8/2/1999 12:00:00 AM 
6/1/2002 12:00:00 AM  37.5000  5/18/2002 12:00:00 AM 

Code

CREATE TABLE [HumanResources].[EmployeePayHistory](
    [EmployeeID] [int] NOT NULL,
    [RateChangeDate] [datetime] NOT NULL,
    [Rate] [money] NOT NULL,
    [PayFrequency] [tinyint] NOT NULL,
    [ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_EmployeePayHistory_EmployeeID_RateChangeDate] PRIMARY KEY CLUSTERED 
(
    [EmployeeID] ASC,
    [RateChangeDate] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

ALTER TABLE [HumanResources].[EmployeePayHistory]  WITH CHECK ADD  CONSTRAINT [FK_EmployeePayHistory_Employee_EmployeeID] FOREIGN KEY([EmployeeID])
REFERENCES [HumanResources].[Employee] ([EmployeeID])
ALTER TABLE [HumanResources].[EmployeePayHistory] CHECK CONSTRAINT [FK_EmployeePayHistory_Employee_EmployeeID]
ALTER TABLE [HumanResources].[EmployeePayHistory]  WITH CHECK ADD  CONSTRAINT [CK_EmployeePayHistory_PayFrequency] CHECK  (([PayFrequency]=(2) OR [PayFrequency]=(1)))
ALTER TABLE [HumanResources].[EmployeePayHistory] CHECK CONSTRAINT [CK_EmployeePayHistory_PayFrequency]
ALTER TABLE [HumanResources].[EmployeePayHistory]  WITH CHECK ADD  CONSTRAINT [CK_EmployeePayHistory_Rate] CHECK  (([Rate]>=(6.50) AND [Rate]<=(200.00)))
ALTER TABLE [HumanResources].[EmployeePayHistory] CHECK CONSTRAINT [CK_EmployeePayHistory_Rate]
ALTER TABLE [HumanResources].[EmployeePayHistory] ADD  CONSTRAINT [DF_EmployeePayHistory_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]

Powered by Yoyodyne © 1971