AdventureWorks
HumanResources.EmployeeAddress Table
Description
Cross-reference table mapping employees to their address(es).
Properties
Creation Date08/01/2010 08:40
File GroupPRIMARY
Text File Group
System Object
Published for Replication
Rows290
Data Space Used16.00 KB
Index Space Used32.00 KB
Columns
 Column NameDescriptionDatatypeLengthAllow NullsDefaultFormula
Primary Key EmployeeIDPrimary key. Foreign key to Employee.EmployeeID.int4   
Primary Key AddressIDPrimary key. Foreign key to Address.AddressID.int4   
 rowguidROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.uniqueidentifier16 
(newid())
 
 ModifiedDateDate and time the record was last updated.datetime4 
(getdate())
 
Indexes
IndexDescriptionPrimaryUnique
AK_EmployeeAddress_rowguidUnique nonclustered index. Used to support replication samples. 
PK_EmployeeAddress_EmployeeID_AddressIDPrimary key (clustered) constraint
Relationships
RelationshipDescription
FK_EmployeeAddress_Address_AddressIDForeign key constraint referencing Address.AddressID.
FK_EmployeeAddress_Employee_EmployeeIDForeign key constraint referencing Employee.EmployeeID.
Objects that depend on HumanResources.EmployeeAddress
 Database ObjectObject TypeDescriptionDep Level
HumanResources.vEmployee viewHumanResources.vEmployeeViewEmployee names and addresses.1
Sales.vSalesPerson viewSales.vSalesPersonViewSales representiatives (names and addresses) and their sales-related information.1
Objects that HumanResources.EmployeeAddress depends on
 Database ObjectObject TypeDescriptionDep Level
Person.Address tablePerson.AddressTableStreet address information for customers, employees, and vendors.1
Person.Contact tablePerson.ContactTableNames of each employee, customer contact, and vendor contact.2
Person.CountryRegion tablePerson.CountryRegionTableLookup table containing the ISO standard codes for countries and regions.3
HumanResources.Employee tableHumanResources.EmployeeTableEmployee information such as salary, department, and title.1
dbo.Name datatypedbo.NameUser Defined Data Type 3
dbo.NameStyle datatypedbo.NameStyleUser Defined Data Type 3
dbo.Phone datatypedbo.PhoneUser Defined Data Type 3
Sales.SalesTerritory tableSales.SalesTerritoryTableSales territory lookup table.3
Person.StateProvince tablePerson.StateProvinceTableState and province lookup table.2
SQL
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
CREATE TABLE [HumanResources].[EmployeeAddress](
	[EmployeeID] [int] NOT NULL,
	[AddressID] [int] NOT NULL,
	[rowguid] [uniqueidentifier] ROWGUIDCOL  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 [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 [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]
See Also

Related Objects

HumanResources Schema
AdventureWorks Database

 

 


© 2012 All Rights Reserved.

Send comments on this topic.