AdventureWorks
HumanResources.EmployeePayHistory Table
Description
Employee pay history.
Properties
Creation Date08/01/2010 08:40
File GroupPRIMARY
Text File Group
System Object
Published for Replication
Rows316
Data Space Used16.00 KB
Index Space Used16.00 KB
Columns
 Column NameDescriptionDatatypeLengthAllow NullsDefaultFormula
Primary Key EmployeeIDEmployee identification number. Foreign key to Employee.EmployeeID.int4   
Primary Key RateChangeDateDate the change in pay is effectivedatetime4   
 RateSalary hourly rate.money8   
 PayFrequency1 = Salary received monthly, 2 = Salary received biweeklytinyint1   
 ModifiedDateDate and time the record was last updated.datetime4 
(getdate())
 
Indexes
IndexDescriptionPrimaryUnique
PK_EmployeePayHistory_EmployeeID_RateChangeDatePrimary key (clustered) constraint
Check Constraints
NameDescriptionExpression
CK_EmployeePayHistory_PayFrequencyCheck constraint [PayFrequency]=(3) OR [PayFrequency]=(2) OR [PayFrequency]=(1)
([PayFrequency]=(2) OR [PayFrequency]=(1))
CK_EmployeePayHistory_RateCheck constraint [Rate] >= (6.50) AND [Rate] <= (200.00)
([Rate]>=(6.50) AND [Rate]<=(200.00))
Relationships
RelationshipDescription
FK_EmployeePayHistory_Employee_EmployeeIDForeign key constraint referencing Employee.EmployeeID.
Objects that depend on HumanResources.EmployeePayHistory
 Database ObjectObject TypeDescriptionDep Level
HumanResources.uspUpdateEmployeeHireInfo procedureHumanResources.uspUpdateEmployeeHireInfoStored ProcedureUpdates the Employee table and inserts a new row in the EmployeePayHistory table with the values specified in the input parameters.1
Objects that HumanResources.EmployeePayHistory depends on
 Database ObjectObject TypeDescriptionDep Level
Person.Contact tablePerson.ContactTableNames of each employee, customer contact, and vendor contact.2
HumanResources.Employee tableHumanResources.EmployeeTableEmployee information such as salary, department, and title.1
dbo.Flag datatypedbo.FlagUser Defined Data Type 2
dbo.Name datatypedbo.NameUser Defined Data Type 3
dbo.NameStyle datatypedbo.NameStyleUser Defined Data Type 3
dbo.Phone datatypedbo.PhoneUser Defined Data Type 3
SQL
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
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 [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]
See Also

Related Objects

HumanResources Schema
AdventureWorks Database

 

 


© 2012 All Rights Reserved.

Send comments on this topic.