Cross-reference table mapping ISO currency codes to a country or region.
| Indexes | Field Name | Data Type | Description |
|---|---|---|---|
| * | 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. | |
Customer credit card information.
| Indexes | Field Name | Data Type | Description |
|---|---|---|---|
| * | 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. | |
Lookup table containing standard ISO currencies.
| Indexes | Field Name | Data Type | Description |
|---|---|---|---|
| * | 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. | |
Currency exchange rates.
| Indexes | Field Name | Data Type | Description |
|---|---|---|---|
| * | 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. | |
Current customer information. Also see the Person and Store tables.
| Indexes | Field Name | Data Type | Description |
|---|---|---|---|
| * | 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. | |
Cross-reference table mapping people to their credit card information in the CreditCard table.
| Indexes | Field Name | Data Type | Description |
|---|---|---|---|
| * | 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. | |
Individual products associated with a specific sales order. See SalesOrderHeader.
| Indexes | Field Name | Data Type | Description |
|---|---|---|---|
| * | 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 | |||
General sales order information.
| Indexes | Field Name | Data Type | Description |
|---|---|---|---|
| * | 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 | |||
Cross-reference table mapping sales orders to sales reason codes.
| Indexes | Field Name | Data Type | Description |
|---|---|---|---|
| * | 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. | |
Sales representative current information.
| Indexes | Field Name | Data Type | Description |
|---|---|---|---|
| * | 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) | ||
Sales performance tracking.
| Indexes | Field Name | Data Type | Description |
|---|---|---|---|
| * | 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) | ||
Lookup table of customer purchase reasons.
| Indexes | Field Name | Data Type | Description |
|---|---|---|---|
| * | 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. | |
Tax rate lookup table.
| Indexes | Field Name | Data Type | Description |
|---|---|---|---|
| * | 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) | ||
Sales territory lookup table.
| Indexes | Field Name | Data Type | Description |
|---|---|---|---|
| * | 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) | ||
Sales representative transfers to other sales territories.
| Indexes | Field Name | Data Type | Description |
|---|---|---|---|
| * | 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 | ||
Sale discounts lookup table.
| Indexes | Field Name | Data Type | Description |
|---|---|---|---|
| * | 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) | ||
Cross-reference table mapping products to special offer discounts.
| Indexes | Field Name | Data Type | Description |
|---|---|---|---|
| * | 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. | |
Customers (resellers) of Adventure Works products.
| Indexes | Field Name | Data Type | Description |
|---|---|---|---|
| * | 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 | |