Database reference - AdventureWorks

AdventureWorks -  tables -  [HumanResources].[EmployeeAddress]

Description

Cross-reference table mapping employees to their address(es). 

Table properties

namevalue
name[HumanResources].[EmployeeAddress]
createdMar 19 2009 9:08PM
modifiedMar 19 2009 9:08PM 
ansi nullson 
quoted identifieron 
row count290
Size of data16 kb
Size of indexes32 kb
Maximum size of a single row32 bytes

Columns

columndatatypelengthbytesdefaultnullsPKFKUQcomputedcomment
EmployeeIDint104 no  composite PK  Employee.EmployeeID      no  Primary key. Foreign key to Employee.EmployeeID. 
AddressIDint104 no  composite PK  Address.AddressID      no  Primary key. Foreign key to Address.AddressID. 
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_EmployeeAddress_rowguidnonclustered, unique located on PRIMARYrowguidUnique nonclustered index. Used to support replication samples. 
PK_EmployeeAddress_EmployeeID_AddressIDclustered, unique, primary key located on PRIMARYEmployeeID, AddressIDClustered index created by a primary key constraint. 

References

name
Employee
Address

Foreign key graph

EmployeeAddressEmployeeAddress

Foreign keys

namecolumnsforeign columnstypecomment
FK_EmployeeAddress_Address_AddressIDAddressIDAddress.AddressID   Foreign key constraint referencing Address.AddressID. 
FK_EmployeeAddress_Employee_EmployeeIDEmployeeIDEmployee.EmployeeID   Foreign key constraint referencing Employee.EmployeeID. 

Defaults

default namecolumncomment
DF_EmployeeAddress_rowguidrowguidDefault constraint value of NEWID() 
DF_EmployeeAddress_ModifiedDateModifiedDateDefault constraint value of GETDATE() 

Dependency graph

DF_EmployeeAddress_ModifiedDateDF_EmployeeAddress_rowguidEmployeeAddressAK_EmployeeAddress_rowguid...PK_EmployeeAddress_EmployeeID_AddressID...vEmployeevSalesPerson

Objects that depend on [HumanResources].[EmployeeAddress]

nameobject typelevel
vEmployeeview1
vSalesPersonview1

Sample rows

EmployeeIDAddressIDrowguidModifiedDate
61  77253aef-8883-4e76-97aa-7b7dac21a2cd  10/13/2004 11:15:06 AM 
234  7fa5ff71-e97b-457d-b7c4-88fb6566dc40  10/13/2004 11:15:06 AM 
224  3c915b31-7c05-4a05-9859-0df663677240  10/13/2004 11:15:06 AM 
11387  3dc70cc4-3ae8-424f-8b1f-481c5478e941  10/13/2004 11:15:06 AM 
8aa698fc-090f-42ee-a197-2e7f7394d9f1  10/13/2004 11:15:06 AM 
214  9cd92f26-342b-4af0-80e3-23fa079912b5  10/13/2004 11:15:06 AM 
92  f306c391-0d6b-43ae-9629-e50f56c01ec1  10/13/2004 11:15:06 AM 
240  57a0819c-5d99-4d72-9340-653a14fefc8a  10/13/2004 11:15:06 AM 
190  c0ed2f68-937b-4594-9459-581ac53c98e3  10/13/2004 11:15:06 AM 
10  56  80ad19f1-7d70-4fd6-864b-f0b3095188dd  10/13/2004 11:15:06 AM 

Code

CREATE TABLE [HumanResources].[EmployeeAddress](
    [EmployeeID] [int] NOT NULL,
    [AddressID] [int] NOT NULL,
    [rowguid] [uniqueidentifier] ROWGUIDCOL  NOT NULL,
    [EmployeeID] [int] NOT NULL,
    [AddressID] [int] NOT NULL,
    [ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_EmployeeAddress_EmployeeID_AddressID] PRIMARY KEY CLUSTERED 
(
    [EmployeeID] ASC,
    [AddressID] 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].[EmployeeAddress]  WITH CHECK ADD  CONSTRAINT [FK_EmployeeAddress_Address_AddressID] FOREIGN KEY([AddressID])
REFERENCES [Person].[Address] ([AddressID])
ALTER TABLE [HumanResources].[EmployeeAddress] CHECK CONSTRAINT [FK_EmployeeAddress_Address_AddressID]
ALTER TABLE [HumanResources].[EmployeeAddress]  WITH CHECK ADD  CONSTRAINT [FK_EmployeeAddress_Employee_EmployeeID] FOREIGN KEY([EmployeeID])
REFERENCES [HumanResources].[Employee] ([EmployeeID])
ALTER TABLE [HumanResources].[EmployeeAddress] CHECK CONSTRAINT [FK_EmployeeAddress_Employee_EmployeeID]
ALTER TABLE [HumanResources].[EmployeeAddress] ADD  CONSTRAINT [DF_EmployeeAddress_rowguid]  DEFAULT (newid()) FOR [rowguid]
ALTER TABLE [HumanResources].[EmployeeAddress] ADD  CONSTRAINT [DF_EmployeeAddress_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]

Powered by Yoyodyne © 1971