AdventureWorks

Basic Index   Expanded Index

Table Name:Sales.SalesTerritoryHistory
Description:Sales representative transfers to other sales territories.
Primary Keys:SalesPersonID
StartDate
TerritoryID
FieldTypeDefaultsNulls?Comments
SalesPersonIDintNoneNoPrimary key for SalesTerritoryHistory records.
TerritoryIDintNoneNoTerritory identification number. Foreign key to SalesTerritory.SalesTerritoryID.
StartDatedatetimeNoneNoDate the sales representive started work in the territory.
EndDatedatetimeNoneYesDate the sales representative left work in the territory.
rowguiduniqueidentifier(newid())NoROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
ModifiedDatedatetime(getdate())NoDate and time the record was last updated.

IndexClustered?Unique?Fields
PK_SalesTerritoryHistory_SalesPersonID_StartDate_TerritoryIDYesYesSalesPersonID
StartDate
TerritoryID
AK_SalesTerritoryHistory_rowguidNoYesrowguid

Check ConstraintText
CK_SalesTerritoryHistory_EndDate([EndDate]>=[StartDate] OR [EndDate] IS NULL)

Internal Foreign Key ConstraintAffected FieldSource Table
FK_SalesTerritoryHistory_SalesPerson_SalesPersonIDSalesPersonIDSales.SalesPerson
FK_SalesTerritoryHistory_SalesTerritory_TerritoryIDTerritoryIDSales.SalesTerritory

No primary keys as foreign key constraints
No triggers