Database reference - AdventureWorks2008

AdventureWorks2008 -  tables -  [HumanResources].[Employee]

Description

Employee information such as salary, department, and title. 

Table properties

namevalue
name[HumanResources].[Employee]
createdMar 19 2009 9:09PM
modifiedMar 19 2009 9:10PM 
ansi nullson 
quoted identifieron 
row count290
Size of data56 kb
Size of indexes136 kb
Maximum size of a single rowNaN bytes

Columns

columndatatypelengthbytesdefaultnullsPKFKUQcomputedcomment
BusinessEntityIDint104 no  yes  Person.BusinessEntityID      no  Primary key for Employee records. Foreign key to BusinessEntity.BusinessEntityID. 
NationalIDNumbernvarchar(15)1560 no      no  Unique national identification number such as a social security number. 
LoginIDnvarchar(256)2561024 no      no  Network login. 
OrganizationNodehierarchyid892variable yes      no  Where the employee is located in corporate hierarchy. 
OrganizationLevelsmallint52 yes      yes  The depth of the employee in the corporate hierarchy. 
JobTitlenvarchar(50)50200 no      no  Work title such as Buyer or Sales Representative. 
BirthDatedate103 no      no  Date of birth. 
MaritalStatusnchar(1)14 no      no  M = Married, S = Single 
Gendernchar(1)14 no      no  M = Male, F = Female 
HireDatedate103 no      no  Employee hired on this date. 
SalariedFlagFlag10((1))no      no  Job classification. 0 = Hourly, not exempt from collective bargaining. 1 = Salaried, exempt from collective bargaining. 
VacationHourssmallint52((0))no      no  Number of available vacation hours. 
SickLeaveHourssmallint52((0))no      no  Number of available sick leave hours. 
CurrentFlagFlag10((1))no      no  0 = Inactive, 1 = Active 
rowguiduniqueidentifier3616(newid())no      no  ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. 
ModifiedDatedatetime238(getdate())no      no  Date and time the record was last updated. 

Indexes

namedescriptioncolumncomment
AK_Employee_LoginIDnonclustered, unique located on PRIMARYLoginIDUnique nonclustered index. 
AK_Employee_NationalIDNumbernonclustered, unique located on PRIMARYNationalIDNumberUnique nonclustered index. 
AK_Employee_rowguidnonclustered, unique located on PRIMARYrowguidUnique nonclustered index. Used to support replication samples. 
IX_Employee_OrganizationLevel_OrganizationNodenonclustered located on PRIMARYOrganizationLevel, OrganizationNodeUnique nonclustered index. 
IX_Employee_OrganizationNodenonclustered located on PRIMARYOrganizationNodeUnique nonclustered index. 
PK_Employee_BusinessEntityIDclustered, unique, primary key located on PRIMARYBusinessEntityIDClustered index created by a primary key constraint. 

References

name
Person

Referenced by

name
EmployeeDepartmentHistory
EmployeePayHistory
JobCandidate
Document
PurchaseOrderHeader
SalesPerson

Foreign key graph

PersonEmployeeEmployeeDepartmentHistoryEmployeePayHistoryJobCandidateDocumentPurchaseOrderHeaderSalesPerson

Foreign keys

namecolumnsforeign columnstypecomment
FK_Employee_Person_BusinessEntityIDBusinessEntityIDPerson.BusinessEntityID   Foreign key constraint referencing Person.BusinessEntityID. 

Check constraints

namecolumncomment
CK_Employee_BirthDateBirthDate    Check constraint [BirthDate] >= '1930-01-01' AND [BirthDate] <= dateadd(year,(-18),GETDATE()) 
CK_Employee_MaritalStatusMaritalStatus    Check constraint [MaritalStatus]='s' OR [MaritalStatus]='m' OR [MaritalStatus]='S' OR [MaritalStatus]='M' 
CK_Employee_HireDateHireDate    Check constraint [HireDate] >= '1996-07-01' AND [HireDate] <= dateadd(day,(1),GETDATE()) 
CK_Employee_GenderGender    Check constraint [Gender]='f' OR [Gender]='m' OR [Gender]='F' OR [Gender]='M' 
CK_Employee_VacationHoursVacationHours    Check constraint [VacationHours] >= (-40) AND [VacationHours] <= (240) 
CK_Employee_SickLeaveHoursSickLeaveHours    Check constraint [SickLeaveHours] >= (0) AND [SickLeaveHours] <= (120) 

Triggers

namecomment
dEmployeeINSTEAD OF DELETE trigger which keeps Employees from being deleted. 

Defaults

default namecolumncomment
DF_Employee_SalariedFlagSalariedFlagDefault constraint value of 1 (TRUE) 
DF_Employee_VacationHoursVacationHoursDefault constraint value of 0 
DF_Employee_SickLeaveHoursSickLeaveHoursDefault constraint value of 0 
DF_Employee_CurrentFlagCurrentFlagDefault constraint value of 1 
DF_Employee_rowguidrowguidDefault constraint value of NEWID() 
DF_Employee_ModifiedDateModifiedDateDefault constraint value of GETDATE() 

Dependency graph

Objects that [HumanResources].[Employee] depends on

nameobject typedatabaseserverlevel
FlagtypeAdventureWorks2008SPRING\KATMAI1

Objects that depend on [HumanResources].[Employee]

nameobject typedatabaseserverlevel
uspGetEmployeeManagersstored procedureAdventureWorks2008SPRING\KATMAI1
uspGetManagerEmployeesstored procedureAdventureWorks2008SPRING\KATMAI1
uspUpdateEmployeeHireInfostored procedureAdventureWorks2008SPRING\KATMAI1
uspUpdateEmployeeLoginstored procedureAdventureWorks2008SPRING\KATMAI1
uspUpdateEmployeePersonalInfostored procedureAdventureWorks2008SPRING\KATMAI1
Employee Sales Summary 2008Reportreportserver_katmaiSPRING1
Product Line Sales 2008Reportreportserver_katmaiSPRING1
Sales Order Detail 2008Reportreportserver_katmaiSPRING1
Territory Sales Drilldown 2008Reportreportserver_katmaiSPRING1
ufnGetContactInformationmulti-statement table valued functionAdventureWorks2008SPRING\KATMAI1
dEmployeetriggerAdventureWorks2008SPRING\KATMAI1
vEmployeeviewAdventureWorks2008SPRING\KATMAI1
vEmployeeDepartmentviewAdventureWorks2008SPRING\KATMAI1
vEmployeeDepartmentHistoryviewAdventureWorks2008SPRING\KATMAI1
vSalesPersonviewAdventureWorks2008SPRING\KATMAI1
vSalesPersonSalesByFiscalYearsviewAdventureWorks2008SPRING\KATMAI1

Sample rows

BusinessEntityIDNationalIDNumberLoginIDOrganizationNodeOrganizationLevelJobTitleBirthDateMaritalStatusGenderHireDateSalariedFlagVacationHoursSickLeaveHoursCurrentFlagrowguidModifiedDate
295847284  adventure-works\ken0  Chief Executive Officer  3/2/1959 12:00:00 AM  2/15/1999 12:00:00 AM  True  99  69  True  f01251e5-96a3-448d-981e-0f99d789110d  7/31/2004 12:00:00 AM 
245797967  adventure-works\terri0  /1/  Vice President of Engineering  9/1/1961 12:00:00 AM  3/3/1998 12:00:00 AM  True  20  True  45e8f437-670d-4409-93cb-f9424a40d6ee  7/31/2004 12:00:00 AM 
509647174  adventure-works\roberto0  /1/1/  Engineering Manager  12/13/1964 12:00:00 AM  12/12/1997 12:00:00 AM  True  21  True  9bbbfb2c-efbb-4217-9ab7-f97689328841  7/31/2004 12:00:00 AM 
112457891  adventure-works\rob0  /1/1/1/  Senior Tool Designer  1/23/1965 12:00:00 AM  1/5/1998 12:00:00 AM  False  48  80  True  59747955-87b8-443f-8ed4-f8ad3afdf3a9  7/31/2004 12:00:00 AM 
695256908  adventure-works\gail0  /1/1/2/  Design Engineer  10/29/1942 12:00:00 AM  2/6/1998 12:00:00 AM  True  22  True  ec84ae09-f9b8-4a15-b4a9-6ccbab919b08  7/31/2004 12:00:00 AM 
998320692  adventure-works\jossef0  /1/1/3/  Design Engineer  4/11/1949 12:00:00 AM  2/24/1998 12:00:00 AM  True  23  True  e39056f1-9cd5-478d-8945-14aca7fbdcdd  7/31/2004 12:00:00 AM 
134969118  adventure-works\dylan0  /1/1/4/  Research and Development Manager  3/27/1977 12:00:00 AM  3/12/1999 12:00:00 AM  True  61  50  True  4f46deca-ef01-41fd-9829-0adab368e431  7/31/2004 12:00:00 AM 
811994146  adventure-works\diane1  /1/1/4/1/  Research and Development Engineer  7/6/1976 12:00:00 AM  1/30/1999 12:00:00 AM  True  62  51  True  31112635-663b-4018-b4a2-a685c0bf48a4  7/31/2004 12:00:00 AM 
658797903  adventure-works\gigi0  /1/1/4/2/  Research and Development Engineer  2/21/1969 12:00:00 AM  2/17/1999 12:00:00 AM  True  63  51  True  50b6cdc6-7570-47ef-9570-48a64b5f2ecf  7/31/2004 12:00:00 AM 
10  879342154  adventure-works\michael6  /1/1/4/3/  Research and Development Manager  1/1/1975 12:00:00 AM  6/4/1999 12:00:00 AM  True  16  64  True  eaa43680-5571-40cb-ab1a-3bf68f04459e  7/31/2004 12:00:00 AM 

Code

SET ARITHABORT ON
CREATE TABLE [HumanResources].[Employee](
    [BusinessEntityID] [int] NOT NULL,
    [NationalIDNumber] [nvarchar](15) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    [LoginID] [nvarchar](256) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    [BusinessEntityID] [int] NOT NULL,
    [NationalIDNumber] [nvarchar](15) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    [OrganizationNode] [hierarchyid] NULL,
    [OrganizationLevel]  AS ([OrganizationNode].[GetLevel]()),
    [JobTitle] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    [BirthDate] [date] NOT NULL,
    [MaritalStatus] [nchar](1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    [Gender] [nchar](1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    [HireDate] [date] NOT NULL,
    [SalariedFlag] [dbo].[Flag] NOT NULL,
    [VacationHours] [smallint] NOT NULL,
    [SickLeaveHours] [smallint] NOT NULL,
    [CurrentFlag] [dbo].[Flag] NOT NULL,
    [rowguid] [uniqueidentifier] ROWGUIDCOL  NOT NULL,
    [ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_Employee_BusinessEntityID] PRIMARY KEY CLUSTERED 
(
    [BusinessEntityID] 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].[Employee]  WITH CHECK ADD  CONSTRAINT [FK_Employee_Person_BusinessEntityID] FOREIGN KEY([BusinessEntityID])
REFERENCES [Person].[Person] ([BusinessEntityID])
ALTER TABLE [HumanResources].[Employee] CHECK CONSTRAINT [FK_Employee_Person_BusinessEntityID]
ALTER TABLE [HumanResources].[Employee]  WITH CHECK ADD  CONSTRAINT [CK_Employee_BirthDate] CHECK  (([BirthDate]>='1930-01-01' AND [BirthDate]<=dateadd(year,(-18),getdate())))
ALTER TABLE [HumanResources].[Employee] CHECK CONSTRAINT [CK_Employee_BirthDate]
ALTER TABLE [HumanResources].[Employee]  WITH CHECK ADD  CONSTRAINT [CK_Employee_Gender] CHECK  ((upper([Gender])='F' OR upper([Gender])='M'))
ALTER TABLE [HumanResources].[Employee] CHECK CONSTRAINT [CK_Employee_Gender]
ALTER TABLE [HumanResources].[Employee]  WITH CHECK ADD  CONSTRAINT [CK_Employee_HireDate] CHECK  (([HireDate]>='1996-07-01' AND [HireDate]<=dateadd(day,(1),getdate())))
ALTER TABLE [HumanResources].[Employee] CHECK CONSTRAINT [CK_Employee_HireDate]
ALTER TABLE [HumanResources].[Employee]  WITH CHECK ADD  CONSTRAINT [CK_Employee_MaritalStatus] CHECK  ((upper([MaritalStatus])='S' OR upper([MaritalStatus])='M'))
ALTER TABLE [HumanResources].[Employee] CHECK CONSTRAINT [CK_Employee_MaritalStatus]
ALTER TABLE [HumanResources].[Employee]  WITH CHECK ADD  CONSTRAINT [CK_Employee_SickLeaveHours] CHECK  (([SickLeaveHours]>=(0) AND [SickLeaveHours]<=(120)))
ALTER TABLE [HumanResources].[Employee] CHECK CONSTRAINT [CK_Employee_SickLeaveHours]
ALTER TABLE [HumanResources].[Employee]  WITH CHECK ADD  CONSTRAINT [CK_Employee_VacationHours] CHECK  (([VacationHours]>=(-40) AND [VacationHours]<=(240)))
ALTER TABLE [HumanResources].[Employee] CHECK CONSTRAINT [CK_Employee_VacationHours]
ALTER TABLE [HumanResources].[Employee] ADD  CONSTRAINT [DF_Employee_SalariedFlag]  DEFAULT ((1)) FOR [SalariedFlag]
ALTER TABLE [HumanResources].[Employee] ADD  CONSTRAINT [DF_Employee_VacationHours]  DEFAULT ((0)) FOR [VacationHours]
ALTER TABLE [HumanResources].[Employee] ADD  CONSTRAINT [DF_Employee_SickLeaveHours]  DEFAULT ((0)) FOR [SickLeaveHours]
ALTER TABLE [HumanResources].[Employee] ADD  CONSTRAINT [DF_Employee_CurrentFlag]  DEFAULT ((1)) FOR [CurrentFlag]
ALTER TABLE [HumanResources].[Employee] ADD  CONSTRAINT [DF_Employee_rowguid]  DEFAULT (newid()) FOR [rowguid]
ALTER TABLE [HumanResources].[Employee] ADD  CONSTRAINT [DF_Employee_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]



Documentation generated by SqlSpec