Database reference - AdventureWorks2008

AdventureWorks2008 -  tables -  [HumanResources].[EmployeePayHistory]

Description

Employee pay history. 

Table properties

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

Columns

columndatatypelengthbytesdefaultnullsPKFKUQcomputedcomment
BusinessEntityIDint104 no  composite PK  Employee.BusinessEntityID      no  Employee identification number. Foreign key to Employee.BusinessEntityID. 
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_BusinessEntityID_RateChangeDateclustered, unique, primary key located on PRIMARYBusinessEntityID, RateChangeDateClustered index created by a primary key constraint. 

References

name
Employee

Foreign key graph

EmployeeEmployeePayHistory

Foreign keys

namecolumnsforeign columnstypecomment
FK_EmployeePayHistory_Employee_BusinessEntityIDBusinessEntityIDEmployee.BusinessEntityID   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_BusinessEntityID_RateChangeD...uspUpdateEmployeeHireInfo

Objects that depend on [HumanResources].[EmployeePayHistory]

nameobject typedatabaseserverlevel
uspUpdateEmployeeHireInfostored procedureAdventureWorks2008SPRING\KATMAI1

Sample rows

BusinessEntityIDRateChangeDateRatePayFrequencyModifiedDate
2/15/1999 12:00:00 AM  125.5000  7/31/2004 12:00:00 AM 
3/3/1998 12:00:00 AM  63.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 
2/6/1998 12:00:00 AM  32.6923  7/31/2004 12:00:00 AM 
2/24/1998 12:00:00 AM  32.6923  7/31/2004 12:00:00 AM 
3/12/1999 12:00:00 AM  50.4808  7/31/2004 12:00:00 AM 
1/30/1999 12:00:00 AM  40.8654  7/31/2004 12:00:00 AM 

Code

CREATE TABLE [HumanResources].[EmployeePayHistory](
    [BusinessEntityID] [int] NOT NULL,
    [RateChangeDate] [datetime] NOT NULL,
    [Rate] [money] NOT NULL,
    [PayFrequency] [tinyint] NOT NULL,
    [ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_EmployeePayHistory_BusinessEntityID_RateChangeDate] PRIMARY KEY CLUSTERED 
(
    [BusinessEntityID] 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_BusinessEntityID] FOREIGN KEY([BusinessEntityID])
REFERENCES [HumanResources].[Employee] ([BusinessEntityID])
ALTER TABLE [HumanResources].[EmployeePayHistory] CHECK CONSTRAINT [FK_EmployeePayHistory_Employee_BusinessEntityID]
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]



Documentation generated by SqlSpec