1 Sales Move the mouse over tables & columns to read the comments. Fk FK_SalesOrderHeader_CreditCard_CreditCardID SalesOrderHeader ref CreditCard ( CreditCardID ) Fk FK_SalesOrderHeader_CurrencyRate_CurrencyRateID SalesOrderHeader ref CurrencyRate ( CurrencyRateID ) Fk FK_SalesOrderHeader_Customer_CustomerID SalesOrderHeader ref Customer ( CustomerID ) Fk FK_SalesOrderHeader_SalesPerson_SalesPersonID SalesOrderHeader ref SalesPerson ( SalesPersonID -> BusinessEntityID ) Fk FK_SalesOrderHeader_SalesTerritory_TerritoryID SalesOrderHeader ref SalesTerritory ( TerritoryID ) Fk FK_SalesOrderHeaderSalesReason_SalesOrderHeader_SalesOrderID SalesOrderHeaderSalesReason ref SalesOrderHeader ( SalesOrderID ) Cascade Fk FK_SalesOrderHeaderSalesReason_SalesReason_SalesReasonID SalesOrderHeaderSalesReason ref SalesReason ( SalesReasonID ) Fk FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID SalesOrderDetail ref SalesOrderHeader ( SalesOrderID ) Cascade Fk FK_SalesOrderDetail_SpecialOfferProduct_SpecialOfferIDProductID SalesOrderDetail ref SpecialOfferProduct ( SpecialOfferID, ProductID ) Fk FK_CurrencyRate_Currency_FromCurrencyCode CurrencyRate ref Currency ( FromCurrencyCode -> CurrencyCode ) Fk FK_CurrencyRate_Currency_ToCurrencyCode CurrencyRate ref Currency ( ToCurrencyCode -> CurrencyCode ) Fk FK_CountryRegionCurrency_Currency_CurrencyCode CountryRegionCurrency ref Currency ( CurrencyCode ) Fk FK_PersonCreditCard_CreditCard_CreditCardID PersonCreditCard ref CreditCard ( CreditCardID ) Fk FK_SpecialOfferProduct_SpecialOffer_SpecialOfferID SpecialOfferProduct ref SpecialOffer ( SpecialOfferID ) Fk FK_SalesPersonQuotaHistory_SalesPerson_BusinessEntityID SalesPersonQuotaHistory ref SalesPerson ( BusinessEntityID ) Fk FK_SalesTerritoryHistory_SalesPerson_BusinessEntityID SalesTerritoryHistory ref SalesPerson ( BusinessEntityID ) Fk FK_SalesTerritoryHistory_SalesTerritory_TerritoryID SalesTerritoryHistory ref SalesTerritory ( TerritoryID ) Fk FK_Customer_SalesTerritory_TerritoryID Customer ref SalesTerritory ( TerritoryID ) Fk FK_Customer_Store_StoreID Customer ref Store ( StoreID -> BusinessEntityID ) Fk FK_SalesPerson_SalesTerritory_TerritoryID SalesPerson ref SalesTerritory ( TerritoryID ) Fk FK_Store_SalesPerson_SalesPersonID Store ref SalesPerson ( SalesPersonID -> BusinessEntityID ) SalesOrderHeaderTable Sales.SalesOrderHeader General sales order information. Pk PK_SalesOrderHeader_SalesOrderID ( SalesOrderID ) Clustered index created by a primary key constraint. SalesOrderIDintSalesOrderID * int Primary key. Referred by SalesOrderDetail ( SalesOrderID ) Referred by SalesOrderHeaderSalesReason ( SalesOrderID ) RevisionNumbertinyintRevisionNumber * tinyint default 0 Incremental number to track changes to the sales order over time. # OrderDatedatetimeOrderDate * datetime default getdate() Dates the sales order was created. d DueDatedatetimeDueDate * datetime Date the order is due to the customer. d ShipDatedatetimeShipDate datetime Date the order was shipped to the customer. d StatustinyintStatus * tinyint default 1 Order current status. 1 = In process; 2 = Approved; 3 = Backordered; 4 = Rejected; 5 = Shipped; 6 = Cancelled # OnlineOrderFlagflagOnlineOrderFlag * flag default 1 0 = Order placed by sales person. 1 = Order placed online by customer. b Unq AK_SalesOrderHeader_SalesOrderNumber ( SalesOrderNumber ) Unique nonclustered index. SalesOrderNumbernvarchar(25)SalesOrderNumber * nvarchar(25) Unique sales order identification number. t PurchaseOrderNumberordernumberPurchaseOrderNumber ordernumber Customer purchase order number reference. t AccountNumberaccountnumberAccountNumber accountnumber Financial accounting number reference. t IX_SalesOrderHeader_CustomerID ( CustomerID ) Nonclustered index. CustomerIDintCustomerID * int Customer identification number. Foreign key to Customer.BusinessEntityID. References Customer ( CustomerID ) IX_SalesOrderHeader_SalesPersonID ( SalesPersonID ) Nonclustered index. SalesPersonIDintSalesPersonID int Sales person who created the sales order. Foreign key to SalesPerson.BusinessEntityID. References SalesPerson ( SalesPersonID -> BusinessEntityID ) TerritoryIDintTerritoryID int Territory in which the sale was made. Foreign key to SalesTerritory.SalesTerritoryID. References SalesTerritory ( TerritoryID ) BillToAddressIDintBillToAddressID * int Customer billing address. Foreign key to Address.AddressID. References Address ( BillToAddressID -> AddressID ) ShipToAddressIDintShipToAddressID * int Customer shipping address. Foreign key to Address.AddressID. References Address ( ShipToAddressID -> AddressID ) ShipMethodIDintShipMethodID * int Shipping method. Foreign key to ShipMethod.ShipMethodID. References ShipMethod ( ShipMethodID ) CreditCardIDintCreditCardID int Credit card identification number. Foreign key to CreditCard.CreditCardID. References CreditCard ( CreditCardID ) CreditCardApprovalCodevarchar(15)CreditCardApprovalCode varchar(15) Approval code provided by the credit card company. t CurrencyRateIDintCurrencyRateID int Currency exchange rate used. Foreign key to CurrencyRate.CurrencyRateID. References CurrencyRate ( CurrencyRateID ) SubTotalmoneySubTotal * money default 0.00 Sales subtotal. Computed as SUM(SalesOrderDetail.LineTotal)for the appropriate SalesOrderID. # TaxAmtmoneyTaxAmt * money default 0.00 Tax amount. # FreightmoneyFreight * money default 0.00 Shipping cost. # TotalDuemoneyTotalDue * money Total due from customer. Computed as Subtotal + TaxAmt + Freight. # Commentnvarchar(128)Comment nvarchar(128) Sales representative comments. t Unq AK_SalesOrderHeader_rowguid ( rowguid ) Unique nonclustered index. Used to support replication samples. rowguiduniqueidentifierrowguid * uniqueidentifier default newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. c ModifiedDatedatetimeModifiedDate * datetime default getdate() Date and time the record was last updated. d SalesOrderHeaderSalesReasonTable Sales.SalesOrderHeaderSalesReason Cross-reference table mapping sales orders to sales reason codes. Pk PK_SalesOrderHeaderSalesReason_SalesOrderID_SalesReasonID ( SalesOrderID, SalesReasonID ) Clustered index created by a primary key constraint. SalesOrderIDintSalesOrderID * int Primary key. Foreign key to SalesOrderHeader.SalesOrderID. References SalesOrderHeader ( SalesOrderID ) Pk PK_SalesOrderHeaderSalesReason_SalesOrderID_SalesReasonID ( SalesOrderID, SalesReasonID ) Clustered index created by a primary key constraint. SalesReasonIDintSalesReasonID * int Primary key. Foreign key to SalesReason.SalesReasonID. References SalesReason ( SalesReasonID ) ModifiedDatedatetimeModifiedDate * datetime default getdate() Date and time the record was last updated. d SalesOrderDetailTable Sales.SalesOrderDetail Individual products associated with a specific sales order. See SalesOrderHeader. Pk PK_SalesOrderDetail_SalesOrderID_SalesOrderDetailID ( SalesOrderID, SalesOrderDetailID ) Clustered index created by a primary key constraint. SalesOrderIDintSalesOrderID * int Primary key. Foreign key to SalesOrderHeader.SalesOrderID. References SalesOrderHeader ( SalesOrderID ) Pk PK_SalesOrderDetail_SalesOrderID_SalesOrderDetailID ( SalesOrderID, SalesOrderDetailID ) Clustered index created by a primary key constraint. SalesOrderDetailIDintSalesOrderDetailID * int Primary key. One incremental unique number per product sold. # CarrierTrackingNumbernvarchar(25)CarrierTrackingNumber nvarchar(25) Shipment tracking number supplied by the shipper. t OrderQtysmallintOrderQty * smallint Quantity ordered per product. # IX_SalesOrderDetail_ProductID ( ProductID ) Nonclustered index. ProductIDintProductID * int Product sold to customer. Foreign key to Product.ProductID. References SpecialOfferProduct ( SpecialOfferID, ProductID ) SpecialOfferIDintSpecialOfferID * int Promotional code. Foreign key to SpecialOffer.SpecialOfferID. References SpecialOfferProduct ( SpecialOfferID, ProductID ) UnitPricemoneyUnitPrice * money Selling price of a single product. # UnitPriceDiscountmoneyUnitPriceDiscount * money default 0.0 Discount amount. # LineTotalnumeric(38,6)LineTotal * numeric(38,6) Per product subtotal. Computed as UnitPrice * (1 - UnitPriceDiscount) * OrderQty. # Unq AK_SalesOrderDetail_rowguid ( rowguid ) Unique nonclustered index. Used to support replication samples. rowguiduniqueidentifierrowguid * uniqueidentifier default newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. c ModifiedDatedatetimeModifiedDate * datetime default getdate() Date and time the record was last updated. d SpecialOfferTable Sales.SpecialOffer Sale discounts lookup table. Pk PK_SpecialOffer_SpecialOfferID ( SpecialOfferID ) Clustered index created by a primary key constraint. SpecialOfferIDintSpecialOfferID * int Primary key for SpecialOffer records. Referred by SpecialOfferProduct ( SpecialOfferID ) Descriptionnvarchar(255)Description * nvarchar(255) Discount description. t DiscountPctsmallmoneyDiscountPct * smallmoney default 0.00 Discount precentage. # Typenvarchar(50)Type * nvarchar(50) Discount type category. t Categorynvarchar(50)Category * nvarchar(50) Group the discount applies to such as Reseller or Customer. t StartDatedatetimeStartDate * datetime Discount start date. d EndDatedatetimeEndDate * datetime Discount end date. d MinQtyintMinQty * int default 0 Minimum discount percent allowed. # MaxQtyintMaxQty int Maximum discount percent allowed. # Unq AK_SpecialOffer_rowguid ( rowguid ) Unique nonclustered index. Used to support replication samples. rowguiduniqueidentifierrowguid * uniqueidentifier default newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. c ModifiedDatedatetimeModifiedDate * datetime default getdate() Date and time the record was last updated. d CurrencyRateTable Sales.CurrencyRate Currency exchange rates. Pk PK_CurrencyRate_CurrencyRateID ( CurrencyRateID ) Clustered index created by a primary key constraint. CurrencyRateIDintCurrencyRateID * int Primary key for CurrencyRate records. Referred by SalesOrderHeader ( CurrencyRateID ) Unq AK_CurrencyRate_CurrencyRateDate_FromCurrencyCode_ToCurrencyCode ( CurrencyRateDate, FromCurrencyCode, ToCurrencyCode ) Unique nonclustered index. CurrencyRateDatedatetimeCurrencyRateDate * datetime Date and time the exchange rate was obtained. d Unq AK_CurrencyRate_CurrencyRateDate_FromCurrencyCode_ToCurrencyCode ( CurrencyRateDate, FromCurrencyCode, ToCurrencyCode ) Unique nonclustered index. FromCurrencyCodenchar(3)FromCurrencyCode * nchar(3) Exchange rate was converted from this currency code. References Currency ( FromCurrencyCode -> CurrencyCode ) Unq AK_CurrencyRate_CurrencyRateDate_FromCurrencyCode_ToCurrencyCode ( CurrencyRateDate, FromCurrencyCode, ToCurrencyCode ) Unique nonclustered index. ToCurrencyCodenchar(3)ToCurrencyCode * nchar(3) Exchange rate was converted to this currency code. References Currency ( ToCurrencyCode -> CurrencyCode ) AverageRatemoneyAverageRate * money Average exchange rate for the day. # EndOfDayRatemoneyEndOfDayRate * money Final exchange rate for the day. # ModifiedDatedatetimeModifiedDate * datetime default getdate() Date and time the record was last updated. d CurrencyTable Sales.Currency Lookup table containing standard ISO currencies. Pk PK_Currency_CurrencyCode ( CurrencyCode ) Clustered index created by a primary key constraint. CurrencyCodenchar(3)CurrencyCode * nchar(3) The ISO code for the Currency. Referred by CountryRegionCurrency ( CurrencyCode ) Referred by CurrencyRate ( FromCurrencyCode -> CurrencyCode ) Referred by CurrencyRate ( ToCurrencyCode -> CurrencyCode ) Unq AK_Currency_Name ( Name ) Unique nonclustered index. NamenameName * name Currency name. t ModifiedDatedatetimeModifiedDate * datetime default getdate() Date and time the record was last updated. d CountryRegionCurrencyTable Sales.CountryRegionCurrency Cross-reference table mapping ISO currency codes to a country or region. Pk PK_CountryRegionCurrency_CountryRegionCode_CurrencyCode ( CountryRegionCode, CurrencyCode ) Clustered index created by a primary key constraint. CountryRegionCodenvarchar(3)CountryRegionCode * nvarchar(3) ISO code for countries and regions. Foreign key to CountryRegion.CountryRegionCode. References CountryRegion ( CountryRegionCode ) Pk PK_CountryRegionCurrency_CountryRegionCode_CurrencyCode ( CountryRegionCode, CurrencyCode ) Clustered index created by a primary key constraint.IX_CountryRegionCurrency_CurrencyCode ( CurrencyCode ) Nonclustered index. CurrencyCodenchar(3)CurrencyCode * nchar(3) ISO standard currency code. Foreign key to Currency.CurrencyCode. References Currency ( CurrencyCode ) ModifiedDatedatetimeModifiedDate * datetime default getdate() Date and time the record was last updated. d CreditCardTable Sales.CreditCard Customer credit card information. Pk PK_CreditCard_CreditCardID ( CreditCardID ) Clustered index created by a primary key constraint. CreditCardIDintCreditCardID * int Primary key for CreditCard records. Referred by PersonCreditCard ( CreditCardID ) Referred by SalesOrderHeader ( CreditCardID ) CardTypenvarchar(50)CardType * nvarchar(50) Credit card name. t Unq AK_CreditCard_CardNumber ( CardNumber ) Unique nonclustered index. CardNumbernvarchar(25)CardNumber * nvarchar(25) Credit card number. t ExpMonthtinyintExpMonth * tinyint Credit card expiration month. # ExpYearsmallintExpYear * smallint Credit card expiration year. # ModifiedDatedatetimeModifiedDate * datetime default getdate() Date and time the record was last updated. d PersonCreditCardTable Sales.PersonCreditCard Cross-reference table mapping people to their credit card information in the CreditCard table. Pk PK_PersonCreditCard_BusinessEntityID_CreditCardID ( BusinessEntityID, CreditCardID ) Clustered index created by a primary key constraint. BusinessEntityIDintBusinessEntityID * int Business entity identification number. Foreign key to Person.BusinessEntityID. References Person ( BusinessEntityID ) Pk PK_PersonCreditCard_BusinessEntityID_CreditCardID ( BusinessEntityID, CreditCardID ) Clustered index created by a primary key constraint. CreditCardIDintCreditCardID * int Credit card identification number. Foreign key to CreditCard.CreditCardID. References CreditCard ( CreditCardID ) ModifiedDatedatetimeModifiedDate * datetime default getdate() Date and time the record was last updated. d SpecialOfferProductTable Sales.SpecialOfferProduct Cross-reference table mapping products to special offer discounts. Pk PK_SpecialOfferProduct_SpecialOfferID_ProductID ( SpecialOfferID, ProductID ) Clustered index created by a primary key constraint. SpecialOfferIDintSpecialOfferID * int Primary key for SpecialOfferProduct records. References SpecialOffer ( SpecialOfferID ) Referred by SalesOrderDetail ( SpecialOfferID, ProductID ) Pk PK_SpecialOfferProduct_SpecialOfferID_ProductID ( SpecialOfferID, ProductID ) Clustered index created by a primary key constraint.IX_SpecialOfferProduct_ProductID ( ProductID ) Nonclustered index. ProductIDintProductID * int Product identification number. Foreign key to Product.ProductID. References Product ( ProductID ) Referred by SalesOrderDetail ( SpecialOfferID, ProductID ) Unq AK_SpecialOfferProduct_rowguid ( rowguid ) Unique nonclustered index. Used to support replication samples. rowguiduniqueidentifierrowguid * uniqueidentifier default newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. c ModifiedDatedatetimeModifiedDate * datetime default getdate() Date and time the record was last updated. d SalesReasonTable Sales.SalesReason Lookup table of customer purchase reasons. Pk PK_SalesReason_SalesReasonID ( SalesReasonID ) Clustered index created by a primary key constraint. SalesReasonIDintSalesReasonID * int Primary key for SalesReason records. Referred by SalesOrderHeaderSalesReason ( SalesReasonID ) NamenameName * name Sales reason description. t ReasonTypenameReasonType * name Category the sales reason belongs to. t ModifiedDatedatetimeModifiedDate * datetime default getdate() Date and time the record was last updated. d SalesTaxRateTable Sales.SalesTaxRate Tax rate lookup table. Pk PK_SalesTaxRate_SalesTaxRateID ( SalesTaxRateID ) Clustered index created by a primary key constraint. SalesTaxRateIDintSalesTaxRateID * int Primary key for SalesTaxRate records. # Unq AK_SalesTaxRate_StateProvinceID_TaxType ( StateProvinceID, TaxType ) Unique nonclustered index. StateProvinceIDintStateProvinceID * int State, province, or country/region the sales tax applies to. References StateProvince ( StateProvinceID ) Unq AK_SalesTaxRate_StateProvinceID_TaxType ( StateProvinceID, TaxType ) Unique nonclustered index. TaxTypetinyintTaxType * tinyint 1 = Tax applied to retail transactions, 2 = Tax applied to wholesale transactions, 3 = Tax applied to all sales (retail and wholesale) transactions. # TaxRatesmallmoneyTaxRate * smallmoney default 0.00 Tax rate amount. # NamenameName * name Tax rate description. t Unq AK_SalesTaxRate_rowguid ( rowguid ) Unique nonclustered index. Used to support replication samples. rowguiduniqueidentifierrowguid * uniqueidentifier default newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. c ModifiedDatedatetimeModifiedDate * datetime default getdate() Date and time the record was last updated. d SalesPersonQuotaHistoryTable Sales.SalesPersonQuotaHistory Sales performance tracking. Pk PK_SalesPersonQuotaHistory_BusinessEntityID_QuotaDate ( BusinessEntityID, QuotaDate ) Clustered index created by a primary key constraint. BusinessEntityIDintBusinessEntityID * int Sales person identification number. Foreign key to SalesPerson.BusinessEntityID. References SalesPerson ( BusinessEntityID ) Pk PK_SalesPersonQuotaHistory_BusinessEntityID_QuotaDate ( BusinessEntityID, QuotaDate ) Clustered index created by a primary key constraint. QuotaDatedatetimeQuotaDate * datetime Sales quota date. d SalesQuotamoneySalesQuota * money Sales quota amount. # Unq AK_SalesPersonQuotaHistory_rowguid ( rowguid ) Unique nonclustered index. Used to support replication samples. rowguiduniqueidentifierrowguid * uniqueidentifier default newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. c ModifiedDatedatetimeModifiedDate * datetime default getdate() Date and time the record was last updated. d SalesTerritoryHistoryTable Sales.SalesTerritoryHistory Sales representative transfers to other sales territories. Pk PK_SalesTerritoryHistory_BusinessEntityID_StartDate_TerritoryID ( BusinessEntityID, StartDate, TerritoryID ) Clustered index created by a primary key constraint. BusinessEntityIDintBusinessEntityID * int Primary key. The sales rep. Foreign key to SalesPerson.BusinessEntityID. References SalesPerson ( BusinessEntityID ) Pk PK_SalesTerritoryHistory_BusinessEntityID_StartDate_TerritoryID ( BusinessEntityID, StartDate, TerritoryID ) Clustered index created by a primary key constraint. StartDatedatetimeStartDate * datetime Primary key. Date the sales representive started work in the territory. d Pk PK_SalesTerritoryHistory_BusinessEntityID_StartDate_TerritoryID ( BusinessEntityID, StartDate, TerritoryID ) Clustered index created by a primary key constraint. TerritoryIDintTerritoryID * int Primary key. Territory identification number. Foreign key to SalesTerritory.SalesTerritoryID. References SalesTerritory ( TerritoryID ) EndDatedatetimeEndDate datetime Date the sales representative left work in the territory. d Unq AK_SalesTerritoryHistory_rowguid ( rowguid ) Unique nonclustered index. Used to support replication samples. rowguiduniqueidentifierrowguid * uniqueidentifier default newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. c ModifiedDatedatetimeModifiedDate * datetime default getdate() Date and time the record was last updated. d CustomerTable Sales.Customer Current customer information. Also see the Person and Store tables. Pk PK_Customer_CustomerID ( CustomerID ) Clustered index created by a primary key constraint. CustomerIDintCustomerID * int Primary key. Referred by SalesOrderHeader ( CustomerID ) PersonIDintPersonID int Foreign key to Person.BusinessEntityID References Person ( PersonID -> BusinessEntityID ) StoreIDintStoreID int Foreign key to Store.BusinessEntityID References Store ( StoreID -> BusinessEntityID ) IX_Customer_TerritoryID ( TerritoryID ) Nonclustered index. TerritoryIDintTerritoryID int ID of the territory in which the customer is located. Foreign key to SalesTerritory.SalesTerritoryID. References SalesTerritory ( TerritoryID ) Unq AK_Customer_AccountNumber ( AccountNumber ) Unique nonclustered index. AccountNumbervarchar(10)AccountNumber * varchar(10) Unique number identifying the customer assigned by the accounting system. t Unq AK_Customer_rowguid ( rowguid ) Unique nonclustered index. Used to support replication samples. rowguiduniqueidentifierrowguid * uniqueidentifier default newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. c ModifiedDatedatetimeModifiedDate * datetime default getdate() Date and time the record was last updated. d SalesTerritoryTable Sales.SalesTerritory Sales territory lookup table. Unq AK_SalesTerritory_Name ( Name ) Unique nonclustered index. NamenameName * name Sales territory description t CountryRegionCodenvarchar(3)CountryRegionCode * nvarchar(3) ISO standard country or region code. Foreign key to CountryRegion.CountryRegionCode. References CountryRegion ( CountryRegionCode ) Groupnvarchar(50)Group * nvarchar(50) Geographic area to which the sales territory belong. t Pk PK_SalesTerritory_TerritoryID ( TerritoryID ) Clustered index created by a primary key constraint. TerritoryIDintTerritoryID * int Primary key for SalesTerritory records. Referred by StateProvince ( TerritoryID ) Referred by Customer ( TerritoryID ) Referred by SalesOrderHeader ( TerritoryID ) Referred by SalesPerson ( TerritoryID ) Referred by SalesTerritoryHistory ( TerritoryID ) SalesYTDmoneySalesYTD * money default 0.00 Sales in the territory year to date. # SalesLastYearmoneySalesLastYear * money default 0.00 Sales in the territory the previous year. # CostYTDmoneyCostYTD * money default 0.00 Business costs in the territory year to date. # CostLastYearmoneyCostLastYear * money default 0.00 Business costs in the territory the previous year. # Unq AK_SalesTerritory_rowguid ( rowguid ) Unique nonclustered index. Used to support replication samples. rowguiduniqueidentifierrowguid * uniqueidentifier default newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. c ModifiedDatedatetimeModifiedDate * datetime default getdate() Date and time the record was last updated. d SalesPersonTable Sales.SalesPerson Sales representative current information. Pk PK_SalesPerson_BusinessEntityID ( BusinessEntityID ) Clustered index created by a primary key constraint. BusinessEntityIDintBusinessEntityID * int Primary key for SalesPerson records. Foreign key to Employee.BusinessEntityID References Employee ( BusinessEntityID ) Referred by SalesOrderHeader ( SalesPersonID -> BusinessEntityID ) Referred by SalesPersonQuotaHistory ( BusinessEntityID ) Referred by SalesTerritoryHistory ( BusinessEntityID ) Referred by Store ( SalesPersonID -> BusinessEntityID ) TerritoryIDintTerritoryID int Territory currently assigned to. Foreign key to SalesTerritory.SalesTerritoryID. References SalesTerritory ( TerritoryID ) SalesQuotamoneySalesQuota money Projected yearly sales. # BonusmoneyBonus * money default 0.00 Bonus due if quota is met. # CommissionPctsmallmoneyCommissionPct * smallmoney default 0.00 Commision percent received per sale. # SalesYTDmoneySalesYTD * money default 0.00 Sales total year to date. # SalesLastYearmoneySalesLastYear * money default 0.00 Sales total of previous year. # Unq AK_SalesPerson_rowguid ( rowguid ) Unique nonclustered index. Used to support replication samples. rowguiduniqueidentifierrowguid * uniqueidentifier default newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. c ModifiedDatedatetimeModifiedDate * datetime default getdate() Date and time the record was last updated. d StoreTable Sales.Store Customers (resellers) of Adventure Works products. Pk PK_Store_BusinessEntityID ( BusinessEntityID ) Clustered index created by a primary key constraint. BusinessEntityIDintBusinessEntityID * int Primary key. Foreign key to Customer.BusinessEntityID. References BusinessEntity ( BusinessEntityID ) Referred by Customer ( StoreID -> BusinessEntityID ) NamenameName * name Name of the store. t IX_Store_SalesPersonID ( SalesPersonID ) Nonclustered index. SalesPersonIDintSalesPersonID int ID of the sales person assigned to the customer. Foreign key to SalesPerson.BusinessEntityID. References SalesPerson ( SalesPersonID -> BusinessEntityID ) DemographicsxmlDemographics xml Demographic informationg about the store such as the number of employees, annual sales and store type. t Unq AK_Store_rowguid ( rowguid ) Unique nonclustered index. Used to support replication samples. rowguiduniqueidentifierrowguid * uniqueidentifier default newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. c ModifiedDatedatetimeModifiedDate * datetime default getdate() Date and time the record was last updated. d


Table CountryRegionCurrency

Cross-reference table mapping ISO currency codes to a country or region.

IndexesField NameData TypeDescription
* CountryRegionCode nvarchar( 3 ) ISO code for countries and regions. Foreign key to CountryRegion.CountryRegionCode.
* CurrencyCode nchar( 3 ) ISO standard currency code. Foreign key to Currency.CurrencyCode.
* ModifiedDate datetime DEFAULT getdate() Date and time the record was last updated.
Indexes
PK_CountryRegionCurrency_CountryRegionCode_CurrencyCode ON CountryRegionCode, CurrencyCode Clustered index created by a primary key constraint.
IX_CountryRegionCurrency_CurrencyCode ON CurrencyCode Nonclustered index.
Foreign Keys
FK_CountryRegionCurrency_CountryRegion_CountryRegionCode ( CountryRegionCode ) ref CountryRegion (CountryRegionCode) Foreign key constraint referencing CountryRegion.CountryRegionCode.
FK_CountryRegionCurrency_Currency_CurrencyCode ( CurrencyCode ) ref Currency (CurrencyCode) Foreign key constraint referencing Currency.CurrencyCode.


Table CreditCard

Customer credit card information.

IndexesField NameData TypeDescription
* CreditCardID int AUTOINCREMENT Primary key for CreditCard records.
* CardType nvarchar( 50 ) Credit card name.
* CardNumber nvarchar( 25 ) Credit card number.
* ExpMonth tinyint Credit card expiration month.
* ExpYear smallint Credit card expiration year.
* ModifiedDate datetime DEFAULT getdate() Date and time the record was last updated.
Indexes
PK_CreditCard_CreditCardID ON CreditCardID Clustered index created by a primary key constraint.
AK_CreditCard_CardNumber ON CardNumber Unique nonclustered index.


Table Currency

Lookup table containing standard ISO currencies.

IndexesField NameData TypeDescription
* CurrencyCode nchar( 3 ) The ISO code for the Currency.
* Name name Currency name.
* ModifiedDate datetime DEFAULT getdate() Date and time the record was last updated.
Indexes
PK_Currency_CurrencyCode ON CurrencyCode Clustered index created by a primary key constraint.
AK_Currency_Name ON Name Unique nonclustered index.


Table CurrencyRate

Currency exchange rates.

IndexesField NameData TypeDescription
* CurrencyRateID int AUTOINCREMENT Primary key for CurrencyRate records.
* CurrencyRateDate datetime Date and time the exchange rate was obtained.
* FromCurrencyCode nchar( 3 ) Exchange rate was converted from this currency code.
* ToCurrencyCode nchar( 3 ) Exchange rate was converted to this currency code.
* AverageRate money Average exchange rate for the day.
* EndOfDayRate money Final exchange rate for the day.
* ModifiedDate datetime DEFAULT getdate() Date and time the record was last updated.
Indexes
PK_CurrencyRate_CurrencyRateID ON CurrencyRateID Clustered index created by a primary key constraint.
AK_CurrencyRate_CurrencyRateDate_FromCurrencyCode_ToCurrencyCode ON CurrencyRateDate, FromCurrencyCode, ToCurrencyCode Unique nonclustered index.
Foreign Keys
FK_CurrencyRate_Currency_FromCurrencyCode ( FromCurrencyCode ) ref Currency (CurrencyCode) Foreign key constraint referencing Currency.FromCurrencyCode.
FK_CurrencyRate_Currency_ToCurrencyCode ( ToCurrencyCode ) ref Currency (CurrencyCode) Foreign key constraint referencing Currency.ToCurrencyCode.


Table Customer

Current customer information. Also see the Person and Store tables.

IndexesField NameData TypeDescription
* CustomerID int AUTOINCREMENT Primary key.
PersonID int Foreign key to Person.BusinessEntityID
StoreID int Foreign key to Store.BusinessEntityID
TerritoryID int ID of the territory in which the customer is located. Foreign key to SalesTerritory.SalesTerritoryID.
* AccountNumber varchar( 10 ) Unique number identifying the customer assigned by the accounting system.
* rowguid uniqueidentifier DEFAULT newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
* ModifiedDate datetime DEFAULT getdate() Date and time the record was last updated.
Indexes
PK_Customer_CustomerID ON CustomerID Clustered index created by a primary key constraint.
AK_Customer_AccountNumber ON AccountNumber Unique nonclustered index.
AK_Customer_rowguid ON rowguid Unique nonclustered index. Used to support replication samples.
IX_Customer_TerritoryID ON TerritoryID Nonclustered index.
Foreign Keys
FK_Customer_Person_PersonID ( PersonID ) ref Person (BusinessEntityID) Foreign key constraint referencing Person.BusinessEntityID.
FK_Customer_SalesTerritory_TerritoryID ( TerritoryID ) ref SalesTerritory (TerritoryID) Foreign key constraint referencing SalesTerritory.TerritoryID.
FK_Customer_Store_StoreID ( StoreID ) ref Store (BusinessEntityID) Foreign key constraint referencing Store.BusinessEntityID.


Table PersonCreditCard

Cross-reference table mapping people to their credit card information in the CreditCard table.

IndexesField NameData TypeDescription
* BusinessEntityID int Business entity identification number. Foreign key to Person.BusinessEntityID.
* CreditCardID int Credit card identification number. Foreign key to CreditCard.CreditCardID.
* ModifiedDate datetime DEFAULT getdate() Date and time the record was last updated.
Indexes
PK_PersonCreditCard_BusinessEntityID_CreditCardID ON BusinessEntityID, CreditCardID Clustered index created by a primary key constraint.
Foreign Keys
FK_PersonCreditCard_CreditCard_CreditCardID ( CreditCardID ) ref CreditCard (CreditCardID) Foreign key constraint referencing CreditCard.CreditCardID.
FK_PersonCreditCard_Person_BusinessEntityID ( BusinessEntityID ) ref Person (BusinessEntityID) Foreign key constraint referencing Person.BusinessEntityID.


Table SalesOrderDetail

Individual products associated with a specific sales order. See SalesOrderHeader.

IndexesField NameData TypeDescription
* SalesOrderID int Primary key. Foreign key to SalesOrderHeader.SalesOrderID.
* SalesOrderDetailID int AUTOINCREMENT Primary key. One incremental unique number per product sold.
  CarrierTrackingNumber nvarchar( 25 ) Shipment tracking number supplied by the shipper.
* OrderQty smallint Quantity ordered per product.
* ProductID int Product sold to customer. Foreign key to Product.ProductID.
* SpecialOfferID int Promotional code. Foreign key to SpecialOffer.SpecialOfferID.
* UnitPrice money Selling price of a single product.
* UnitPriceDiscount money DEFAULT 0.0 Discount amount.
* LineTotal numeric( 38, 6 ) Per product subtotal. Computed as UnitPrice * (1 - UnitPriceDiscount) * OrderQty.
* rowguid uniqueidentifier DEFAULT newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
* ModifiedDate datetime DEFAULT getdate() Date and time the record was last updated.
Indexes
PK_SalesOrderDetail_SalesOrderID_SalesOrderDetailID ON SalesOrderID, SalesOrderDetailID Clustered index created by a primary key constraint.
AK_SalesOrderDetail_rowguid ON rowguid Unique nonclustered index. Used to support replication samples.
IX_SalesOrderDetail_ProductID ON ProductID Nonclustered index.
Foreign Keys
FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID ( SalesOrderID ) ref SalesOrderHeader (SalesOrderID) Foreign key constraint referencing SalesOrderHeader.PurchaseOrderID.
FK_SalesOrderDetail_SpecialOfferProduct_SpecialOfferIDProductID ( SpecialOfferID, ProductID ) ref SpecialOfferProduct (SpecialOfferID, ProductID) Foreign key constraint referencing SpecialOfferProduct.SpecialOfferIDProductID.
Constraints
  CK_SalesOrderDetail_OrderQty [OrderQty]>(0)
  CK_SalesOrderDetail_UnitPrice [UnitPrice]>=(0.00)
  CK_SalesOrderDetail_UnitPriceDiscount [UnitPriceDiscount]>=(0.00)
Triggers
  iduSalesOrderDetail


Table SalesOrderHeader

General sales order information.

IndexesField NameData TypeDescription
* SalesOrderID int AUTOINCREMENT Primary key.
* RevisionNumber tinyint DEFAULT 0 Incremental number to track changes to the sales order over time.
* OrderDate datetime DEFAULT getdate() Dates the sales order was created.
* DueDate datetime Date the order is due to the customer.
  ShipDate datetime Date the order was shipped to the customer.
* Status tinyint DEFAULT 1 Order current status. 1 = In process; 2 = Approved; 3 = Backordered; 4 = Rejected; 5 = Shipped; 6 = Cancelled
* OnlineOrderFlag flag DEFAULT 1 0 = Order placed by sales person. 1 = Order placed online by customer.
* SalesOrderNumber nvarchar( 25 ) Unique sales order identification number.
  PurchaseOrderNumber ordernumber Customer purchase order number reference.
  AccountNumber accountnumber Financial accounting number reference.
* CustomerID int Customer identification number. Foreign key to Customer.BusinessEntityID.
SalesPersonID int Sales person who created the sales order. Foreign key to SalesPerson.BusinessEntityID.
TerritoryID int Territory in which the sale was made. Foreign key to SalesTerritory.SalesTerritoryID.
* BillToAddressID int Customer billing address. Foreign key to Address.AddressID.
* ShipToAddressID int Customer shipping address. Foreign key to Address.AddressID.
* ShipMethodID int Shipping method. Foreign key to ShipMethod.ShipMethodID.
CreditCardID int Credit card identification number. Foreign key to CreditCard.CreditCardID.
  CreditCardApprovalCode varchar( 15 ) Approval code provided by the credit card company.
CurrencyRateID int Currency exchange rate used. Foreign key to CurrencyRate.CurrencyRateID.
* SubTotal money DEFAULT 0.00 Sales subtotal. Computed as SUM(SalesOrderDetail.LineTotal)for the appropriate SalesOrderID.
* TaxAmt money DEFAULT 0.00 Tax amount.
* Freight money DEFAULT 0.00 Shipping cost.
* TotalDue money Total due from customer. Computed as Subtotal + TaxAmt + Freight.
  Comment nvarchar( 128 ) Sales representative comments.
* rowguid uniqueidentifier DEFAULT newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
* ModifiedDate datetime DEFAULT getdate() Date and time the record was last updated.
Indexes
PK_SalesOrderHeader_SalesOrderID ON SalesOrderID Clustered index created by a primary key constraint.
AK_SalesOrderHeader_rowguid ON rowguid Unique nonclustered index. Used to support replication samples.
AK_SalesOrderHeader_SalesOrderNumber ON SalesOrderNumber Unique nonclustered index.
IX_SalesOrderHeader_CustomerID ON CustomerID Nonclustered index.
IX_SalesOrderHeader_SalesPersonID ON SalesPersonID Nonclustered index.
Foreign Keys
FK_SalesOrderHeader_Address_BillToAddressID ( BillToAddressID ) ref Address (AddressID) Foreign key constraint referencing Address.AddressID.
FK_SalesOrderHeader_Address_ShipToAddressID ( ShipToAddressID ) ref Address (AddressID) Foreign key constraint referencing Address.AddressID.
FK_SalesOrderHeader_CreditCard_CreditCardID ( CreditCardID ) ref CreditCard (CreditCardID) Foreign key constraint referencing CreditCard.CreditCardID.
FK_SalesOrderHeader_CurrencyRate_CurrencyRateID ( CurrencyRateID ) ref CurrencyRate (CurrencyRateID) Foreign key constraint referencing CurrencyRate.CurrencyRateID.
FK_SalesOrderHeader_Customer_CustomerID ( CustomerID ) ref Customer (CustomerID) Foreign key constraint referencing Customer.CustomerID.
FK_SalesOrderHeader_SalesPerson_SalesPersonID ( SalesPersonID ) ref SalesPerson (BusinessEntityID) Foreign key constraint referencing SalesPerson.SalesPersonID.
FK_SalesOrderHeader_SalesTerritory_TerritoryID ( TerritoryID ) ref SalesTerritory (TerritoryID) Foreign key constraint referencing SalesTerritory.TerritoryID.
FK_SalesOrderHeader_ShipMethod_ShipMethodID ( ShipMethodID ) ref ShipMethod (ShipMethodID) Foreign key constraint referencing ShipMethod.ShipMethodID.
Constraints
  CK_SalesOrderHeader_DueDate [DueDate]>=[OrderDate]
  CK_SalesOrderHeader_ShipDate [ShipDate]>=[OrderDate] OR [ShipDate] IS NULL
  CK_SalesOrderHeader_DueDate [DueDate]>=[OrderDate]
  CK_SalesOrderHeader_ShipDate [ShipDate]>=[OrderDate] OR [ShipDate] IS NULL
  CK_SalesOrderHeader_Status [Status]>=(0) AND [Status]<=(8)
  CK_SalesOrderHeader_SubTotal [SubTotal]>=(0.00)
  CK_SalesOrderHeader_TaxAmt [TaxAmt]>=(0.00)
  CK_SalesOrderHeader_Freight [Freight]>=(0.00)
Triggers
  uSalesOrderHeader


Table SalesOrderHeaderSalesReason

Cross-reference table mapping sales orders to sales reason codes.

IndexesField NameData TypeDescription
* SalesOrderID int Primary key. Foreign key to SalesOrderHeader.SalesOrderID.
* SalesReasonID int Primary key. Foreign key to SalesReason.SalesReasonID.
* ModifiedDate datetime DEFAULT getdate() Date and time the record was last updated.
Indexes
PK_SalesOrderHeaderSalesReason_SalesOrderID_SalesReasonID ON SalesOrderID, SalesReasonID Clustered index created by a primary key constraint.
Foreign Keys
FK_SalesOrderHeaderSalesReason_SalesOrderHeader_SalesOrderID ( SalesOrderID ) ref SalesOrderHeader (SalesOrderID) Foreign key constraint referencing SalesOrderHeader.SalesOrderID.
FK_SalesOrderHeaderSalesReason_SalesReason_SalesReasonID ( SalesReasonID ) ref SalesReason (SalesReasonID) Foreign key constraint referencing SalesReason.SalesReasonID.


Table SalesPerson

Sales representative current information.

IndexesField NameData TypeDescription
* BusinessEntityID int Primary key for SalesPerson records. Foreign key to Employee.BusinessEntityID
TerritoryID int Territory currently assigned to. Foreign key to SalesTerritory.SalesTerritoryID.
  SalesQuota money Projected yearly sales.
* Bonus money DEFAULT 0.00 Bonus due if quota is met.
* CommissionPct smallmoney DEFAULT 0.00 Commision percent received per sale.
* SalesYTD money DEFAULT 0.00 Sales total year to date.
* SalesLastYear money DEFAULT 0.00 Sales total of previous year.
* rowguid uniqueidentifier DEFAULT newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
* ModifiedDate datetime DEFAULT getdate() Date and time the record was last updated.
Indexes
PK_SalesPerson_BusinessEntityID ON BusinessEntityID Clustered index created by a primary key constraint.
AK_SalesPerson_rowguid ON rowguid Unique nonclustered index. Used to support replication samples.
Foreign Keys
FK_SalesPerson_Employee_BusinessEntityID ( BusinessEntityID ) ref Employee (BusinessEntityID) Foreign key constraint referencing Employee.EmployeeID.
FK_SalesPerson_SalesTerritory_TerritoryID ( TerritoryID ) ref SalesTerritory (TerritoryID) Foreign key constraint referencing SalesTerritory.TerritoryID.
Constraints
  CK_SalesPerson_SalesQuota [SalesQuota]>(0.00)
  CK_SalesPerson_Bonus [Bonus]>=(0.00)
  CK_SalesPerson_CommissionPct [CommissionPct]>=(0.00)
  CK_SalesPerson_SalesYTD [SalesYTD]>=(0.00)
  CK_SalesPerson_SalesLastYear [SalesLastYear]>=(0.00)


Table SalesPersonQuotaHistory

Sales performance tracking.

IndexesField NameData TypeDescription
* BusinessEntityID int Sales person identification number. Foreign key to SalesPerson.BusinessEntityID.
* QuotaDate datetime Sales quota date.
* SalesQuota money Sales quota amount.
* rowguid uniqueidentifier DEFAULT newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
* ModifiedDate datetime DEFAULT getdate() Date and time the record was last updated.
Indexes
PK_SalesPersonQuotaHistory_BusinessEntityID_QuotaDate ON BusinessEntityID, QuotaDate Clustered index created by a primary key constraint.
AK_SalesPersonQuotaHistory_rowguid ON rowguid Unique nonclustered index. Used to support replication samples.
Foreign Keys
FK_SalesPersonQuotaHistory_SalesPerson_BusinessEntityID ( BusinessEntityID ) ref SalesPerson (BusinessEntityID) Foreign key constraint referencing SalesPerson.SalesPersonID.
Constraints
  CK_SalesPersonQuotaHistory_SalesQuota [SalesQuota]>(0.00)


Table SalesReason

Lookup table of customer purchase reasons.

IndexesField NameData TypeDescription
* SalesReasonID int AUTOINCREMENT Primary key for SalesReason records.
* Name name Sales reason description.
* ReasonType name Category the sales reason belongs to.
* ModifiedDate datetime DEFAULT getdate() Date and time the record was last updated.
Indexes
PK_SalesReason_SalesReasonID ON SalesReasonID Clustered index created by a primary key constraint.


Table SalesTaxRate

Tax rate lookup table.

IndexesField NameData TypeDescription
* SalesTaxRateID int AUTOINCREMENT Primary key for SalesTaxRate records.
* StateProvinceID int State, province, or country/region the sales tax applies to.
* TaxType tinyint 1 = Tax applied to retail transactions, 2 = Tax applied to wholesale transactions, 3 = Tax applied to all sales (retail and wholesale) transactions.
* TaxRate smallmoney DEFAULT 0.00 Tax rate amount.
* Name name Tax rate description.
* rowguid uniqueidentifier DEFAULT newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
* ModifiedDate datetime DEFAULT getdate() Date and time the record was last updated.
Indexes
PK_SalesTaxRate_SalesTaxRateID ON SalesTaxRateID Clustered index created by a primary key constraint.
AK_SalesTaxRate_rowguid ON rowguid Unique nonclustered index. Used to support replication samples.
AK_SalesTaxRate_StateProvinceID_TaxType ON StateProvinceID, TaxType Unique nonclustered index.
Foreign Keys
FK_SalesTaxRate_StateProvince_StateProvinceID ( StateProvinceID ) ref StateProvince (StateProvinceID) Foreign key constraint referencing StateProvince.StateProvinceID.
Constraints
  CK_SalesTaxRate_TaxType [TaxType]>=(1) AND [TaxType]<=(3)


Table SalesTerritory

Sales territory lookup table.

IndexesField NameData TypeDescription
* Name name Sales territory description
* CountryRegionCode nvarchar( 3 ) ISO standard country or region code. Foreign key to CountryRegion.CountryRegionCode.
* Group nvarchar( 50 ) Geographic area to which the sales territory belong.
* TerritoryID int AUTOINCREMENT Primary key for SalesTerritory records.
* SalesYTD money DEFAULT 0.00 Sales in the territory year to date.
* SalesLastYear money DEFAULT 0.00 Sales in the territory the previous year.
* CostYTD money DEFAULT 0.00 Business costs in the territory year to date.
* CostLastYear money DEFAULT 0.00 Business costs in the territory the previous year.
* rowguid uniqueidentifier DEFAULT newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
* ModifiedDate datetime DEFAULT getdate() Date and time the record was last updated.
Indexes
PK_SalesTerritory_TerritoryID ON TerritoryID Clustered index created by a primary key constraint.
AK_SalesTerritory_Name ON Name Unique nonclustered index.
AK_SalesTerritory_rowguid ON rowguid Unique nonclustered index. Used to support replication samples.
Foreign Keys
FK_SalesTerritory_CountryRegion_CountryRegionCode ( CountryRegionCode ) ref CountryRegion (CountryRegionCode) Foreign key constraint referencing CountryRegion.CountryRegionCode.
Constraints
  CK_SalesTerritory_SalesYTD [SalesYTD]>=(0.00)
  CK_SalesTerritory_SalesLastYear [SalesLastYear]>=(0.00)
  CK_SalesTerritory_CostYTD [CostYTD]>=(0.00)
  CK_SalesTerritory_CostLastYear [CostLastYear]>=(0.00)


Table SalesTerritoryHistory

Sales representative transfers to other sales territories.

IndexesField NameData TypeDescription
* BusinessEntityID int Primary key. The sales rep. Foreign key to SalesPerson.BusinessEntityID.
* StartDate datetime Primary key. Date the sales representive started work in the territory.
* TerritoryID int Primary key. Territory identification number. Foreign key to SalesTerritory.SalesTerritoryID.
  EndDate datetime Date the sales representative left work in the territory.
* rowguid uniqueidentifier DEFAULT newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
* ModifiedDate datetime DEFAULT getdate() Date and time the record was last updated.
Indexes
PK_SalesTerritoryHistory_BusinessEntityID_StartDate_TerritoryID ON BusinessEntityID, StartDate, TerritoryID Clustered index created by a primary key constraint.
AK_SalesTerritoryHistory_rowguid ON rowguid Unique nonclustered index. Used to support replication samples.
Foreign Keys
FK_SalesTerritoryHistory_SalesPerson_BusinessEntityID ( BusinessEntityID ) ref SalesPerson (BusinessEntityID) Foreign key constraint referencing SalesPerson.SalesPersonID.
FK_SalesTerritoryHistory_SalesTerritory_TerritoryID ( TerritoryID ) ref SalesTerritory (TerritoryID) Foreign key constraint referencing SalesTerritory.TerritoryID.
Constraints
  CK_SalesTerritoryHistory_EndDate [EndDate]>=[StartDate] OR [EndDate] IS NULL
  CK_SalesTerritoryHistory_EndDate [EndDate]>=[StartDate] OR [EndDate] IS NULL


Table SpecialOffer

Sale discounts lookup table.

IndexesField NameData TypeDescription
* SpecialOfferID int AUTOINCREMENT Primary key for SpecialOffer records.
* Description nvarchar( 255 ) Discount description.
* DiscountPct smallmoney DEFAULT 0.00 Discount precentage.
* Type nvarchar( 50 ) Discount type category.
* Category nvarchar( 50 ) Group the discount applies to such as Reseller or Customer.
* StartDate datetime Discount start date.
* EndDate datetime Discount end date.
* MinQty int DEFAULT 0 Minimum discount percent allowed.
  MaxQty int Maximum discount percent allowed.
* rowguid uniqueidentifier DEFAULT newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
* ModifiedDate datetime DEFAULT getdate() Date and time the record was last updated.
Indexes
PK_SpecialOffer_SpecialOfferID ON SpecialOfferID Clustered index created by a primary key constraint.
AK_SpecialOffer_rowguid ON rowguid Unique nonclustered index. Used to support replication samples.
Constraints
  CK_SpecialOffer_DiscountPct [DiscountPct]>=(0.00)
  CK_SpecialOffer_EndDate [EndDate]>=[StartDate]
  CK_SpecialOffer_EndDate [EndDate]>=[StartDate]
  CK_SpecialOffer_MinQty [MinQty]>=(0)
  CK_SpecialOffer_MaxQty [MaxQty]>=(0)


Table SpecialOfferProduct

Cross-reference table mapping products to special offer discounts.

IndexesField NameData TypeDescription
* SpecialOfferID int Primary key for SpecialOfferProduct records.
* ProductID int Product identification number. Foreign key to Product.ProductID.
* rowguid uniqueidentifier DEFAULT newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
* ModifiedDate datetime DEFAULT getdate() Date and time the record was last updated.
Indexes
PK_SpecialOfferProduct_SpecialOfferID_ProductID ON SpecialOfferID, ProductID Clustered index created by a primary key constraint.
AK_SpecialOfferProduct_rowguid ON rowguid Unique nonclustered index. Used to support replication samples.
IX_SpecialOfferProduct_ProductID ON ProductID Nonclustered index.
Foreign Keys
FK_SpecialOfferProduct_Product_ProductID ( ProductID ) ref Product (ProductID) Foreign key constraint referencing Product.ProductID.
FK_SpecialOfferProduct_SpecialOffer_SpecialOfferID ( SpecialOfferID ) ref SpecialOffer (SpecialOfferID) Foreign key constraint referencing SpecialOffer.SpecialOfferID.


Table Store

Customers (resellers) of Adventure Works products.

IndexesField NameData TypeDescription
* BusinessEntityID int Primary key. Foreign key to Customer.BusinessEntityID.
* Name name Name of the store.
SalesPersonID int ID of the sales person assigned to the customer. Foreign key to SalesPerson.BusinessEntityID.
  Demographics xml Demographic informationg about the store such as the number of employees, annual sales and store type.
* rowguid uniqueidentifier DEFAULT newid() ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.
* ModifiedDate datetime DEFAULT getdate() Date and time the record was last updated.
Indexes
PK_Store_BusinessEntityID ON BusinessEntityID Clustered index created by a primary key constraint.
AK_Store_rowguid ON rowguid Unique nonclustered index. Used to support replication samples.
IX_Store_SalesPersonID ON SalesPersonID Nonclustered index.
Foreign Keys
FK_Store_BusinessEntity_BusinessEntityID ( BusinessEntityID ) ref BusinessEntity (BusinessEntityID) Foreign key constraint referencing BusinessEntity.BusinessEntityID
FK_Store_SalesPerson_SalesPersonID ( SalesPersonID ) ref SalesPerson (BusinessEntityID) Foreign key constraint referencing SalesPerson.SalesPersonID

Powered by DbSchema