Database reference - AdventureWorks

AdventureWorks -  tables -  [HumanResources].[Shift]

Description

Work shift lookup table. 

Table properties

namevalue
name[HumanResources].[Shift]
createdMar 19 2009 9:08PM
modifiedMar 19 2009 9:08PM 
ansi nullson 
quoted identifieron 
row count3
Size of data8 kb
Size of indexes40 kb
Maximum size of a single row225 bytes

Columns

columndatatypelengthbytesdefaultnullsPKFKUQcomputedcomment
ShiftIDtinyint identity(1,1)31 no  yes    no  Primary key for Shift records. 
NameName50200 no      no  Shift description. 
StartTimedatetime238 no      no  Shift start time. 
EndTimedatetime238 no      no  Shift end time. 
ModifiedDatedatetime238(getdate())no      no  Date and time the record was last updated. 

Indexes

namedescriptioncolumncomment
AK_Shift_Namenonclustered, unique located on PRIMARYNameUnique nonclustered index. 
AK_Shift_StartTime_EndTimenonclustered, unique located on PRIMARYStartTime, EndTimeUnique nonclustered index. 
PK_Shift_ShiftIDclustered, unique, primary key located on PRIMARYShiftIDClustered index created by a primary key constraint. 

Referenced by

name
EmployeeDepartmentHistory

Foreign key graph

ShiftEmployeeDepartmentHistory

Defaults

default namecolumncomment
DF_Shift_ModifiedDateModifiedDateDefault constraint value of GETDATE() 

Dependency graph

DF_Shift_ModifiedDateNameShiftAK_Shift_NameAK_Shift_StartTime_EndTime...PK_Shift_ShiftIDvEmployeeDepartmentHistory

Objects that [HumanResources].[Shift] depends on

nameobject typelevel
Nametype1

Objects that depend on [HumanResources].[Shift]

nameobject typelevel
vEmployeeDepartmentHistoryview1

Sample rows

ShiftIDNameStartTimeEndTimeModifiedDate
Day  1/1/1900 7:00:00 AM  1/1/1900 3:00:00 PM  6/1/1998 12:00:00 AM 
Evening  1/1/1900 3:00:00 PM  1/1/1900 11:00:00 PM  6/1/1998 12:00:00 AM 
Night  1/1/1900 11:00:00 PM  1/1/1900 7:00:00 AM  6/1/1998 12:00:00 AM 

Code

CREATE TABLE [HumanResources].[Shift](
    [ShiftID] [tinyint] IDENTITY(1,1) NOT NULL,
    [Name] [dbo].[Name] NOT NULL,
    [ShiftID] [tinyint] IDENTITY(1,1) NOT NULL,
    [StartTime] [datetime] NOT NULL,
    [EndTime] [datetime] NOT NULL,
    [ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_Shift_ShiftID] PRIMARY KEY CLUSTERED 
(
    [ShiftID] 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].[Shift] ADD  CONSTRAINT [DF_Shift_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]

Powered by Yoyodyne © 1971