Northwind Database (Document! X Sample)
AdventureWorks Database / HumanResources Schema / HumanResources.EmployeePayHistory Table
In This Topic
    HumanResources.EmployeePayHistory Table
    In This Topic
    Description
    Employee pay history.
    Properties
    Creation Date27/10/2017 14:33
    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 Employee identification number. Foreign key to Employee.BusinessEntityID.Integer4   
    Primary Key Date the change in pay is effectiveDBTimeStamp4   
     Salary hourly rate.Currency8   
     1 = Salary received monthly, 2 = Salary received biweeklyUnsignedTinyInt1   
     Date and time the record was last updated.DBTimeStamp4 
    (getdate())
     
    Indexes
    IndexDescriptionPrimaryUnique
    Primary key (clustered) constraint
    Check Constraints
    NameDescriptionExpression
    Check constraint [PayFrequency]=(3) OR [PayFrequency]=(2) OR [PayFrequency]=(1)
    ([PayFrequency]=(2) OR [PayFrequency]=(1))
    Check constraint [Rate] >= (6.50) AND [Rate] <= (200.00)
    ([Rate]>=(6.50) AND [Rate]<=(200.00))
    Relationships
    RelationshipDescription
    Foreign 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.2
    Objects that HumanResources.EmployeePayHistory depends on
     Database ObjectObject TypeDescriptionDep Level
    Person.BusinessEntity tablePerson.BusinessEntityTableSource of the ID that connects vendors, customers, and employees with address and contact information.2
    HumanResources.Employee tableHumanResources.EmployeeTableEmployee information such as salary, department, and title.3
    dbo.Flag datatypedbo.FlagUser Defined Data Type 4
    dbo.Name datatypedbo.NameUser Defined Data Type 2
    dbo.NameStyle datatypedbo.NameStyleUser Defined Data Type 5
    Person.Person tablePerson.PersonTableHuman beings involved with AdventureWorks: employees, customer contacts, and vendor contacts.4
    SQL
    SET ANSI_NULLS ON
    SET QUOTED_IDENTIFIER ON
    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] ADD  CONSTRAINT [DF_EmployeePayHistory_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]
    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]
    See Also