Current version number of the AdventureWorks 2016 sample database.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | SystemInformationID | tinyint AUTOINCREMENT | Primary key for AWBuildVersion records. |
| * | Database Version | nvarchar(25) | Version number of the database in 9.yy.mm.dd.00 format. |
| * | VersionDate | datetime | Date and time the record was last updated. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_AWBuildVersion_SystemInformationID | ON SystemInformationID | Clustered index created by a primary key constraint. | |
Street address information for customers, employees, and vendors.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | AddressID | int AUTOINCREMENT | Primary key for Address records. |
| * | AddressLine1 | nvarchar(60) | First street address line. |
| AddressLine2 | nvarchar(60) | Second street address line. | |
| * | City | nvarchar(30) | Name of the city. |
| * | StateProvinceID | int | Unique identification number for the state or province. Foreign key to StateProvince table. |
| * | PostalCode | nvarchar(15) | Postal code for the street address. |
| SpatialLocation | geography | Latitude and longitude of this address. | |
| * | 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_Address_AddressID | ON AddressID | Clustered index created by a primary key constraint. | |
| AK_Address_rowguid | ON rowguid | Unique nonclustered index. Used to support replication samples. | |
| IX_Address_AddressLine1_AddressLine2_City_StateProvinceID_PostalCode | ON AddressLine1, AddressLine2, City, StateProvinceID, PostalCode | Nonclustered index. | |
| IX_Address_StateProvinceID | ON StateProvinceID | Nonclustered index. | |
| Foreign Keys | |||
| FK_Address_StateProvince_StateProvinceID | ( StateProvinceID ) ref StateProvince (StateProvinceID) | Foreign key constraint referencing StateProvince.StateProvinceID. | |
Types of addresses stored in the Address table.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | AddressTypeID | int AUTOINCREMENT | Primary key for AddressType records. |
| * | Name | name | Address type description. For example, Billing, Home, or Shipping. |
| * | 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_AddressType_AddressTypeID | ON AddressTypeID | Clustered index created by a primary key constraint. | |
| AK_AddressType_Name | ON Name | Unique nonclustered index. | |
| AK_AddressType_rowguid | ON rowguid | Unique nonclustered index. Used to support replication samples. | |
Items required to make bicycles and bicycle subassemblies. It identifies the heirarchical relationship between a parent product and its components.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | BillOfMaterialsID | int AUTOINCREMENT | Primary key for BillOfMaterials records. |
| ProductAssemblyID | int | Parent product identification number. Foreign key to Product.ProductID. | |
| * | ComponentID | int | Component identification number. Foreign key to Product.ProductID. |
| * | StartDate | datetime DEFAULT getdate() | Date the component started being used in the assembly item. |
| EndDate | datetime | Date the component stopped being used in the assembly item. | |
| * | UnitMeasureCode | nchar(3) | Standard code identifying the unit of measure for the quantity. |
| * | BOMLevel | smallint | Indicates the depth the component is from its parent (AssemblyID). |
| * | PerAssemblyQty | decimal(8,2) DEFAULT 1.00 | Quantity of the component needed to create the assembly. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_BillOfMaterials_BillOfMaterialsID | ON BillOfMaterialsID | Nonclustered index created by a primary key constraint. | |
| AK_BillOfMaterials_ProductAssemblyID_ComponentID_StartDate | ON ProductAssemblyID, ComponentID, StartDate | Clustered index. | |
| IX_BillOfMaterials_UnitMeasureCode | ON UnitMeasureCode | Nonclustered index. | |
| Foreign Keys | |||
| FK_BillOfMaterials_Product_ComponentID | ( ComponentID ) ref Product (ProductID) | Foreign key constraint referencing Product.ComponentID. | |
| FK_BillOfMaterials_Product_ProductAssemblyID | ( ProductAssemblyID ) ref Product (ProductID) | Foreign key constraint referencing Product.ProductAssemblyID. | |
| FK_BillOfMaterials_UnitMeasure_UnitMeasureCode | ( UnitMeasureCode ) ref UnitMeasure (UnitMeasureCode) | Foreign key constraint referencing UnitMeasure.UnitMeasureCode. | |
| Constraints | |||
| CK_BillOfMaterials_ProductAssemblyID | [ProductAssemblyID]<>[ComponentID] | ||
| CK_BillOfMaterials_BOMLevel | [ProductAssemblyID] IS NULL AND [BOMLevel]=(0) AND [PerAssemblyQty]=(1.00) OR [ProductAssemblyID] IS NOT NULL AND [BOMLevel]>=(1) | ||
| CK_BillOfMaterials_ProductAssemblyID | [ProductAssemblyID]<>[ComponentID] | ||
| CK_BillOfMaterials_EndDate | [EndDate]>[StartDate] OR [EndDate] IS NULL | ||
| CK_BillOfMaterials_EndDate | [EndDate]>[StartDate] OR [EndDate] IS NULL | ||
| CK_BillOfMaterials_BOMLevel | [ProductAssemblyID] IS NULL AND [BOMLevel]=(0) AND [PerAssemblyQty]=(1.00) OR [ProductAssemblyID] IS NOT NULL AND [BOMLevel]>=(1) | ||
| CK_BillOfMaterials_BOMLevel | [ProductAssemblyID] IS NULL AND [BOMLevel]=(0) AND [PerAssemblyQty]=(1.00) OR [ProductAssemblyID] IS NOT NULL AND [BOMLevel]>=(1) | ||
| CK_BillOfMaterials_PerAssemblyQty | [PerAssemblyQty]>=(1.00) | ||
Source of the ID that connects vendors, customers, and employees with address and contact information.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | BusinessEntityID | int AUTOINCREMENT | Primary key for all customers, vendors, and employees. |
| * | 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_BusinessEntity_BusinessEntityID | ON BusinessEntityID | Clustered index created by a primary key constraint. | |
| AK_BusinessEntity_rowguid | ON rowguid | Unique nonclustered index. Used to support replication samples. | |
Cross-reference table mapping customers, vendors, and employees to their addresses.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | BusinessEntityID | int | Primary key. Foreign key to BusinessEntity.BusinessEntityID. |
| * | AddressID | int | Primary key. Foreign key to Address.AddressID. |
| * | AddressTypeID | int | Primary key. Foreign key to AddressType.AddressTypeID. |
| * | 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_BusinessEntityAddress_BusinessEntityID_AddressID_AddressTypeID | ON BusinessEntityID, AddressID, AddressTypeID | Clustered index created by a primary key constraint. | |
| AK_BusinessEntityAddress_rowguid | ON rowguid | Unique nonclustered index. Used to support replication samples. | |
| IX_BusinessEntityAddress_AddressID | ON AddressID | Nonclustered index. | |
| IX_BusinessEntityAddress_AddressTypeID | ON AddressTypeID | Nonclustered index. | |
| Foreign Keys | |||
| FK_BusinessEntityAddress_Address_AddressID | ( AddressID ) ref Address (AddressID) | Foreign key constraint referencing Address.AddressID. | |
| FK_BusinessEntityAddress_AddressType_AddressTypeID | ( AddressTypeID ) ref AddressType (AddressTypeID) | Foreign key constraint referencing AddressType.AddressTypeID. | |
| FK_BusinessEntityAddress_BusinessEntity_BusinessEntityID | ( BusinessEntityID ) ref BusinessEntity (BusinessEntityID) | Foreign key constraint referencing BusinessEntity.BusinessEntityID. | |
Cross-reference table mapping stores, vendors, and employees to people
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | BusinessEntityID | int | Primary key. Foreign key to BusinessEntity.BusinessEntityID. |
| * | PersonID | int | Primary key. Foreign key to Person.BusinessEntityID. |
| * | ContactTypeID | int | Primary key. Foreign key to ContactType.ContactTypeID. |
| * | 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_BusinessEntityContact_BusinessEntityID_PersonID_ContactTypeID | ON BusinessEntityID, PersonID, ContactTypeID | Clustered index created by a primary key constraint. | |
| AK_BusinessEntityContact_rowguid | ON rowguid | Unique nonclustered index. Used to support replication samples. | |
| IX_BusinessEntityContact_ContactTypeID | ON ContactTypeID | Nonclustered index. | |
| IX_BusinessEntityContact_PersonID | ON PersonID | Nonclustered index. | |
| Foreign Keys | |||
| FK_BusinessEntityContact_BusinessEntity_BusinessEntityID | ( BusinessEntityID ) ref BusinessEntity (BusinessEntityID) | Foreign key constraint referencing BusinessEntity.BusinessEntityID. | |
| FK_BusinessEntityContact_ContactType_ContactTypeID | ( ContactTypeID ) ref ContactType (ContactTypeID) | Foreign key constraint referencing ContactType.ContactTypeID. | |
| FK_BusinessEntityContact_Person_PersonID | ( PersonID ) ref Person (BusinessEntityID) | Foreign key constraint referencing Person.BusinessEntityID. | |
Lookup table containing the types of business entity contacts.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | ContactTypeID | int AUTOINCREMENT | Primary key for ContactType records. |
| * | Name | name | Contact type description. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_ContactType_ContactTypeID | ON ContactTypeID | Clustered index created by a primary key constraint. | |
| AK_ContactType_Name | ON Name | Unique nonclustered index. | |
Lookup table containing the ISO standard codes for countries and regions.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | CountryRegionCode | nvarchar(3) | ISO standard code for countries and regions. |
| * | Name | name | Country or region name. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_CountryRegion_CountryRegionCode | ON CountryRegionCode | Clustered index created by a primary key constraint. | |
| AK_CountryRegion_Name | ON Name | Unique nonclustered index. | |
Cross-reference table mapping ISO currency codes to a country or region.
| Idx | 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.
| Idx | 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 the languages in which some AdventureWorks data is stored.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | CultureID | nchar(6) | Primary key for Culture records. |
| * | Name | name | Culture description. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_Culture_CultureID | ON CultureID | Clustered index created by a primary key constraint. | |
| AK_Culture_Name | ON Name | Unique nonclustered index. | |
Lookup table containing standard ISO currencies.
| Idx | 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.
| Idx | 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.
| Idx | 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. | |
Audit table tracking all DDL changes made to the AdventureWorks database. Data is captured by the database trigger ddlDatabaseTriggerLog.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | DatabaseLogID | int AUTOINCREMENT | Primary key for DatabaseLog records. |
| * | PostTime | datetime | The date and time the DDL change occurred. |
| * | DatabaseUser | sysname | The user who implemented the DDL change. |
| * | Event | sysname | The type of DDL statement that was executed. |
| Schema | sysname | The schema to which the changed object belongs. | |
| Object | sysname | The object that was changed by the DDL statment. | |
| * | TSQL | nvarchar(max) | The exact Transact-SQL statement that was executed. |
| * | XmlEvent | xml | The raw XML data generated by database trigger. |
| Indexes | |||
| PK_DatabaseLog_DatabaseLogID | ON DatabaseLogID | Nonclustered index created by a primary key constraint. | |
Lookup table containing the departments within the Adventure Works Cycles company.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | DepartmentID | smallint AUTOINCREMENT | Primary key for Department records. |
| * | Name | name | Name of the department. |
| * | GroupName | name | Name of the group to which the department belongs. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_Department_DepartmentID | ON DepartmentID | Clustered index created by a primary key constraint. | |
| AK_Department_Name | ON Name | Unique nonclustered index. | |
Product maintenance documents.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | DocumentNode | hierarchyid | Primary key for Document records. |
| DocumentLevel | smallint | Depth in the document hierarchy. | |
| * | Title | nvarchar(50) | Title of the document. |
| * | Owner | int | Employee who controls the document. Foreign key to Employee.BusinessEntityID |
| * | FolderFlag | bit DEFAULT 0 | 0 = This is a folder, 1 = This is a document. |
| * | FileName | nvarchar(400) | File name of the document |
| * | FileExtension | nvarchar(8) | File extension indicating the document type. For example, .doc or .txt. |
| * | Revision | nchar(5) | Revision number of the document. |
| * | ChangeNumber | int DEFAULT 0 | Engineering change approval number. |
| * | Status | tinyint | 1 = Pending approval, 2 = Approved, 3 = Obsolete |
| DocumentSummary | nvarchar(max) | Document abstract. | |
| Document | varbinary(max) | Complete document. | |
| * | rowguid | uniqueidentifier DEFAULT newid() | ROWGUIDCOL number uniquely identifying the record. Required for FileStream. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_Document_DocumentNode | ON DocumentNode | Clustered index created by a primary key constraint. | |
| AK_Document_DocumentLevel_DocumentNode | ON DocumentLevel, DocumentNode | Unique nonclustered index. | |
| UQ__Document__F73921F7C5112C2E | ON rowguid | ||
| IX_Document_FileName_Revision | ON FileName, Revision | Unique nonclustered index. | |
| Foreign Keys | |||
| FK_Document_Employee_Owner | ( Owner ) ref Employee (BusinessEntityID) | Foreign key constraint referencing Employee.BusinessEntityID. | |
| Constraints | |||
| CK_Document_Status | [Status]>=(1) AND [Status]<=(3) | ||
Where to send a person email.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | BusinessEntityID | int | Primary key. Person associated with this email address. Foreign key to Person.BusinessEntityID |
| * | EmailAddressID | int AUTOINCREMENT | Primary key. ID of this email address. |
| EmailAddress | nvarchar(50) | E-mail address for the person. | |
| * | 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_EmailAddress_BusinessEntityID_EmailAddressID | ON BusinessEntityID, EmailAddressID | Clustered index created by a primary key constraint. | |
| IX_EmailAddress_EmailAddress | ON EmailAddress | Nonclustered index. | |
| Foreign Keys | |||
| FK_EmailAddress_Person_BusinessEntityID | ( BusinessEntityID ) ref Person (BusinessEntityID) | Foreign key constraint referencing Person.BusinessEntityID. | |
Employee information such as salary, department, and title.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | BusinessEntityID | int | Primary key for Employee records. Foreign key to BusinessEntity.BusinessEntityID. |
| * | NationalIDNumber | nvarchar(15) | Unique national identification number such as a social security number. |
| * | LoginID | nvarchar(256) | Network login. |
| OrganizationNode | hierarchyid | Where the employee is located in corporate hierarchy. | |
| OrganizationLevel | smallint | The depth of the employee in the corporate hierarchy. | |
| * | JobTitle | nvarchar(50) | Work title such as Buyer or Sales Representative. |
| * | BirthDate | date | Date of birth. |
| * | MaritalStatus | nchar(1) | M = Married, S = Single |
| * | Gender | nchar(1) | M = Male, F = Female |
| * | HireDate | date | Employee hired on this date. |
| * | SalariedFlag | flag DEFAULT 1 | Job classification. 0 = Hourly, not exempt from collective bargaining. 1 = Salaried, exempt from collective bargaining. |
| * | VacationHours | smallint DEFAULT 0 | Number of available vacation hours. |
| * | SickLeaveHours | smallint DEFAULT 0 | Number of available sick leave hours. |
| * | CurrentFlag | flag DEFAULT 1 | 0 = Inactive, 1 = Active |
| * | 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_Employee_BusinessEntityID | ON BusinessEntityID | Clustered index created by a primary key constraint. | |
| AK_Employee_LoginID | ON LoginID | Unique nonclustered index. | |
| AK_Employee_NationalIDNumber | ON NationalIDNumber | Unique nonclustered index. | |
| AK_Employee_rowguid | ON rowguid | Unique nonclustered index. Used to support replication samples. | |
| IX_Employee_OrganizationLevel_OrganizationNode | ON OrganizationLevel, OrganizationNode | Unique nonclustered index. | |
| IX_Employee_OrganizationNode | ON OrganizationNode | Unique nonclustered index. | |
| Foreign Keys | |||
| FK_Employee_Person_BusinessEntityID | ( BusinessEntityID ) ref Person (BusinessEntityID) | Foreign key constraint referencing Person.BusinessEntityID. | |
| Constraints | |||
| CK_Employee_BirthDate | [BirthDate]>='1930-01-01' AND [BirthDate]<=dateadd(year,(-18),getdate()) | ||
| CK_Employee_MaritalStatus | upper([MaritalStatus])='S' OR upper([MaritalStatus])='M' | ||
| CK_Employee_Gender | upper([Gender])='F' OR upper([Gender])='M' | ||
| CK_Employee_HireDate | [HireDate]>='1996-07-01' AND [HireDate]<=dateadd(day,(1),getdate()) | ||
| CK_Employee_VacationHours | [VacationHours]>=(-40) AND [VacationHours]<=(240) | ||
| CK_Employee_SickLeaveHours | [SickLeaveHours]>=(0) AND [SickLeaveHours]<=(120) | ||
| Triggers | |||
| dEmployee | |||
Employee department transfers.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | BusinessEntityID | int | Employee identification number. Foreign key to Employee.BusinessEntityID. |
| * | StartDate | date | Date the employee started work in the department. |
| * | DepartmentID | smallint | Department in which the employee worked including currently. Foreign key to Department.DepartmentID. |
| * | ShiftID | tinyint | Identifies which 8-hour shift the employee works. Foreign key to Shift.Shift.ID. |
| EndDate | date | Date the employee left the department. NULL = Current department. | |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_EmployeeDepartmentHistory_BusinessEntityID_StartDate_DepartmentID | ON BusinessEntityID, StartDate, DepartmentID, ShiftID | Clustered index created by a primary key constraint. | |
| IX_EmployeeDepartmentHistory_DepartmentID | ON DepartmentID | Nonclustered index. | |
| IX_EmployeeDepartmentHistory_ShiftID | ON ShiftID | Nonclustered index. | |
| Foreign Keys | |||
| FK_EmployeeDepartmentHistory_Department_DepartmentID | ( DepartmentID ) ref Department (DepartmentID) | Foreign key constraint referencing Department.DepartmentID. | |
| FK_EmployeeDepartmentHistory_Employee_BusinessEntityID | ( BusinessEntityID ) ref Employee (BusinessEntityID) | Foreign key constraint referencing Employee.EmployeeID. | |
| FK_EmployeeDepartmentHistory_Shift_ShiftID | ( ShiftID ) ref Shift (ShiftID) | Foreign key constraint referencing Shift.ShiftID | |
| Constraints | |||
| CK_EmployeeDepartmentHistory_EndDate | [EndDate]>=[StartDate] OR [EndDate] IS NULL | ||
| CK_EmployeeDepartmentHistory_EndDate | [EndDate]>=[StartDate] OR [EndDate] IS NULL | ||
Employee pay history.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | BusinessEntityID | int | Employee identification number. Foreign key to Employee.BusinessEntityID. |
| * | RateChangeDate | datetime | Date the change in pay is effective |
| * | Rate | money | Salary hourly rate. |
| * | PayFrequency | tinyint | 1 = Salary received monthly, 2 = Salary received biweekly |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_EmployeePayHistory_BusinessEntityID_RateChangeDate | ON BusinessEntityID, RateChangeDate | Clustered index created by a primary key constraint. | |
| Foreign Keys | |||
| FK_EmployeePayHistory_Employee_BusinessEntityID | ( BusinessEntityID ) ref Employee (BusinessEntityID) | Foreign key constraint referencing Employee.EmployeeID. | |
| Constraints | |||
| CK_EmployeePayHistory_Rate | [Rate]>=(6.50) AND [Rate]<=(200.00) | ||
| CK_EmployeePayHistory_PayFrequency | [PayFrequency]=(2) OR [PayFrequency]=(1) | ||
Audit table tracking errors in the the AdventureWorks database that are caught by the CATCH block of a TRY...CATCH construct. Data is inserted by stored procedure dbo.uspLogError when it is executed from inside the CATCH block of a TRY...CATCH construct.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | ErrorLogID | int AUTOINCREMENT | Primary key for ErrorLog records. |
| * | ErrorTime | datetime DEFAULT getdate() | The date and time at which the error occurred. |
| * | UserName | sysname | The user who executed the batch in which the error occurred. |
| * | ErrorNumber | int | The error number of the error that occurred. |
| ErrorSeverity | int | The severity of the error that occurred. | |
| ErrorState | int | The state number of the error that occurred. | |
| ErrorProcedure | nvarchar(126) | The name of the stored procedure or trigger where the error occurred. | |
| ErrorLine | int | The line number at which the error occurred. | |
| * | ErrorMessage | nvarchar(4000) | The message text of the error that occurred. |
| Indexes | |||
| PK_ErrorLog_ErrorLogID | ON ErrorLogID | Clustered index created by a primary key constraint. | |
Bicycle assembly diagrams.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | IllustrationID | int AUTOINCREMENT | Primary key for Illustration records. |
| Diagram | xml | Illustrations used in manufacturing instructions. Stored as XML. | |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_Illustration_IllustrationID | ON IllustrationID | Clustered index created by a primary key constraint. | |
Résumés submitted to Human Resources by job applicants.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | JobCandidateID | int AUTOINCREMENT | Primary key for JobCandidate records. |
| BusinessEntityID | int | Employee identification number if applicant was hired. Foreign key to Employee.BusinessEntityID. | |
| Resume | xml | Résumé in XML format. | |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_JobCandidate_JobCandidateID | ON JobCandidateID | Clustered index created by a primary key constraint. | |
| IX_JobCandidate_BusinessEntityID | ON BusinessEntityID | Nonclustered index. | |
| Foreign Keys | |||
| FK_JobCandidate_Employee_BusinessEntityID | ( BusinessEntityID ) ref Employee (BusinessEntityID) | Foreign key constraint referencing Employee.EmployeeID. | |
Product inventory and manufacturing locations.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | LocationID | smallint AUTOINCREMENT | Primary key for Location records. |
| * | Name | name | Location description. |
| * | CostRate | smallmoney DEFAULT 0.00 | Standard hourly cost of the manufacturing location. |
| * | Availability | decimal(8,2) DEFAULT 0.00 | Work capacity (in hours) of the manufacturing location. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_Location_LocationID | ON LocationID | Clustered index created by a primary key constraint. | |
| AK_Location_Name | ON Name | Unique nonclustered index. | |
| Constraints | |||
| CK_Location_CostRate | [CostRate]>=(0.00) | ||
| CK_Location_Availability | [Availability]>=(0.00) | ||
One way hashed authentication information
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | BusinessEntityID | int | |
| * | PasswordHash | varchar(128) | Password for the e-mail account. |
| * | PasswordSalt | varchar(10) | Random value concatenated with the password string before the password is hashed. |
| * | 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_Password_BusinessEntityID | ON BusinessEntityID | Clustered index created by a primary key constraint. | |
| Foreign Keys | |||
| FK_Password_Person_BusinessEntityID | ( BusinessEntityID ) ref Person (BusinessEntityID) | Foreign key constraint referencing Person.BusinessEntityID. | |
Human beings involved with AdventureWorks: employees, customer contacts, and vendor contacts.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | BusinessEntityID | int | Primary key for Person records. |
| * | PersonType | nchar(2) | Primary type of person: SC = Store Contact, IN = Individual (retail) customer, SP = Sales person, EM = Employee (non-sales), VC = Vendor contact, GC = General contact |
| * | NameStyle | namestyle DEFAULT 0 | 0 = The data in FirstName and LastName are stored in western style (first name, last name) order. 1 = Eastern style (last name, first name) order. |
| Title | nvarchar(8) | A courtesy title. For example, Mr. or Ms. | |
| * | FirstName | name | First name of the person. |
| MiddleName | name | Middle name or middle initial of the person. | |
| * | LastName | name | Last name of the person. |
| Suffix | nvarchar(10) | Surname suffix. For example, Sr. or Jr. | |
| * | EmailPromotion | int DEFAULT 0 | 0 = Contact does not wish to receive e-mail promotions, 1 = Contact does wish to receive e-mail promotions from AdventureWorks, 2 = Contact does wish to receive e-mail promotions from AdventureWorks and selected partners. |
| AdditionalContactInfo | xml | Additional contact information about the person stored in xml format. | |
| Demographics | xml | Personal information such as hobbies, and income collected from online shoppers. Used for sales analysis. | |
| * | 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_Person_BusinessEntityID | ON BusinessEntityID | Clustered index created by a primary key constraint. | |
| AK_Person_rowguid | ON rowguid | Unique nonclustered index. Used to support replication samples. | |
| IX_Person_LastName_FirstName_MiddleName | ON LastName, FirstName, MiddleName | ||
| Foreign Keys | |||
| FK_Person_BusinessEntity_BusinessEntityID | ( BusinessEntityID ) ref BusinessEntity (BusinessEntityID) | Foreign key constraint referencing BusinessEntity.BusinessEntityID. | |
| Constraints | |||
| CK_Person_PersonType | [PersonType] IS NULL OR (upper([PersonType])='GC' OR upper([PersonType])='SP' OR upper([PersonType])='EM' OR upper([PersonType])='IN' OR upper([PersonType])='VC' OR upper([PersonType])='SC') | ||
| CK_Person_EmailPromotion | [EmailPromotion]>=(0) AND [EmailPromotion]<=(2) | ||
| Triggers | |||
| iuPerson | |||
Cross-reference table mapping people to their credit card information in the CreditCard table.
| Idx | 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. | |
Telephone number and type of a person.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | BusinessEntityID | int | Business entity identification number. Foreign key to Person.BusinessEntityID. |
| * | PhoneNumber | phone | Telephone number identification number. |
| * | PhoneNumberTypeID | int | Kind of phone number. Foreign key to PhoneNumberType.PhoneNumberTypeID. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_PersonPhone_BusinessEntityID_PhoneNumber_PhoneNumberTypeID | ON BusinessEntityID, PhoneNumber, PhoneNumberTypeID | Clustered index created by a primary key constraint. | |
| IX_PersonPhone_PhoneNumber | ON PhoneNumber | Nonclustered index. | |
| Foreign Keys | |||
| FK_PersonPhone_Person_BusinessEntityID | ( BusinessEntityID ) ref Person (BusinessEntityID) | Foreign key constraint referencing Person.BusinessEntityID. | |
| FK_PersonPhone_PhoneNumberType_PhoneNumberTypeID | ( PhoneNumberTypeID ) ref PhoneNumberType (PhoneNumberTypeID) | Foreign key constraint referencing PhoneNumberType.PhoneNumberTypeID. | |
Type of phone number of a person.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | PhoneNumberTypeID | int AUTOINCREMENT | Primary key for telephone number type records. |
| * | Name | name | Name of the telephone number type |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_PhoneNumberType_PhoneNumberTypeID | ON PhoneNumberTypeID | Clustered index created by a primary key constraint. | |
Products sold or used in the manfacturing of sold products.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | ProductID | int AUTOINCREMENT | Primary key for Product records. |
| * | Name | name | Name of the product. |
| * | ProductNumber | nvarchar(25) | Unique product identification number. |
| * | MakeFlag | flag DEFAULT 1 | 0 = Product is purchased, 1 = Product is manufactured in-house. |
| * | FinishedGoodsFlag | flag DEFAULT 1 | 0 = Product is not a salable item. 1 = Product is salable. |
| Color | nvarchar(15) | Product color. | |
| * | SafetyStockLevel | smallint | Minimum inventory quantity. |
| * | ReorderPoint | smallint | Inventory level that triggers a purchase order or work order. |
| * | StandardCost | money | Standard cost of the product. |
| * | ListPrice | money | Selling price. |
| Size | nvarchar(5) | Product size. | |
| SizeUnitMeasureCode | nchar(3) | Unit of measure for Size column. | |
| WeightUnitMeasureCode | nchar(3) | Unit of measure for Weight column. | |
| Weight | decimal(8,2) | Product weight. | |
| * | DaysToManufacture | int | Number of days required to manufacture the product. |
| ProductLine | nchar(2) | R = Road, M = Mountain, T = Touring, S = Standard | |
| Class | nchar(2) | H = High, M = Medium, L = Low | |
| Style | nchar(2) | W = Womens, M = Mens, U = Universal | |
| ProductSubcategoryID | int | Product is a member of this product subcategory. Foreign key to ProductSubCategory.ProductSubCategoryID. | |
| ProductModelID | int | Product is a member of this product model. Foreign key to ProductModel.ProductModelID. | |
| * | SellStartDate | datetime | Date the product was available for sale. |
| SellEndDate | datetime | Date the product was no longer available for sale. | |
| DiscontinuedDate | datetime | Date the product was discontinued. | |
| * | 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_Product_ProductID | ON ProductID | Clustered index created by a primary key constraint. | |
| AK_Product_Name | ON Name | Unique nonclustered index. | |
| AK_Product_ProductNumber | ON ProductNumber | Unique nonclustered index. | |
| AK_Product_rowguid | ON rowguid | Unique nonclustered index. Used to support replication samples. | |
| Foreign Keys | |||
| FK_Product_ProductModel_ProductModelID | ( ProductModelID ) ref ProductModel (ProductModelID) | Foreign key constraint referencing ProductModel.ProductModelID. | |
| FK_Product_ProductSubcategory_ProductSubcategoryID | ( ProductSubcategoryID ) ref ProductSubcategory (ProductSubcategoryID) | Foreign key constraint referencing ProductSubcategory.ProductSubcategoryID. | |
| FK_Product_UnitMeasure_SizeUnitMeasureCode | ( SizeUnitMeasureCode ) ref UnitMeasure (UnitMeasureCode) | Foreign key constraint referencing UnitMeasure.UnitMeasureCode. | |
| FK_Product_UnitMeasure_WeightUnitMeasureCode | ( WeightUnitMeasureCode ) ref UnitMeasure (UnitMeasureCode) | Foreign key constraint referencing UnitMeasure.UnitMeasureCode. | |
| Constraints | |||
| CK_Product_SafetyStockLevel | [SafetyStockLevel]>(0) | ||
| CK_Product_ReorderPoint | [ReorderPoint]>(0) | ||
| CK_Product_StandardCost | [StandardCost]>=(0.00) | ||
| CK_Product_ListPrice | [ListPrice]>=(0.00) | ||
| CK_Product_Weight | [Weight]>(0.00) | ||
| CK_Product_DaysToManufacture | [DaysToManufacture]>=(0) | ||
| CK_Product_ProductLine | upper([ProductLine])='R' OR upper([ProductLine])='M' OR upper([ProductLine])='T' OR upper([ProductLine])='S' OR [ProductLine] IS NULL | ||
| CK_Product_Class | upper([Class])='H' OR upper([Class])='M' OR upper([Class])='L' OR [Class] IS NULL | ||
| CK_Product_Style | upper([Style])='U' OR upper([Style])='M' OR upper([Style])='W' OR [Style] IS NULL | ||
| CK_Product_SellEndDate | [SellEndDate]>=[SellStartDate] OR [SellEndDate] IS NULL | ||
| CK_Product_SellEndDate | [SellEndDate]>=[SellStartDate] OR [SellEndDate] IS NULL | ||
High-level product categorization.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | ProductCategoryID | int AUTOINCREMENT | Primary key for ProductCategory records. |
| * | Name | name | Category 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_ProductCategory_ProductCategoryID | ON ProductCategoryID | Clustered index created by a primary key constraint. | |
| AK_ProductCategory_Name | ON Name | Unique nonclustered index. | |
| AK_ProductCategory_rowguid | ON rowguid | Unique nonclustered index. Used to support replication samples. | |
Changes in the cost of a product over time.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | ProductID | int | Product identification number. Foreign key to Product.ProductID |
| * | StartDate | datetime | Product cost start date. |
| EndDate | datetime | Product cost end date. | |
| * | StandardCost | money | Standard cost of the product. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_ProductCostHistory_ProductID_StartDate | ON ProductID, StartDate | Clustered index created by a primary key constraint. | |
| Foreign Keys | |||
| FK_ProductCostHistory_Product_ProductID | ( ProductID ) ref Product (ProductID) | Foreign key constraint referencing Product.ProductID. | |
| Constraints | |||
| CK_ProductCostHistory_EndDate | [EndDate]>=[StartDate] OR [EndDate] IS NULL | ||
| CK_ProductCostHistory_EndDate | [EndDate]>=[StartDate] OR [EndDate] IS NULL | ||
| CK_ProductCostHistory_StandardCost | [StandardCost]>=(0.00) | ||
Product descriptions in several languages.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | ProductDescriptionID | int AUTOINCREMENT | Primary key for ProductDescription records. |
| * | Description | nvarchar(400) | Description of the product. |
| * | 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_ProductDescription_ProductDescriptionID | ON ProductDescriptionID | Clustered index created by a primary key constraint. | |
| AK_ProductDescription_rowguid | ON rowguid | Unique nonclustered index. Used to support replication samples. | |
Cross-reference table mapping products to related product documents.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | ProductID | int | Product identification number. Foreign key to Product.ProductID. |
| * | DocumentNode | hierarchyid | Document identification number. Foreign key to Document.DocumentNode. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_ProductDocument_ProductID_DocumentNode | ON ProductID, DocumentNode | Clustered index created by a primary key constraint. | |
| Foreign Keys | |||
| FK_ProductDocument_Document_DocumentNode | ( DocumentNode ) ref Document (DocumentNode) | Foreign key constraint referencing Document.DocumentNode. | |
| FK_ProductDocument_Product_ProductID | ( ProductID ) ref Product (ProductID) | Foreign key constraint referencing Product.ProductID. | |
Product inventory information.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | ProductID | int | Product identification number. Foreign key to Product.ProductID. |
| * | LocationID | smallint | Inventory location identification number. Foreign key to Location.LocationID. |
| * | Shelf | nvarchar(10) | Storage compartment within an inventory location. |
| * | Bin | tinyint | Storage container on a shelf in an inventory location. |
| * | Quantity | smallint DEFAULT 0 | Quantity of products in the inventory location. |
| * | 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_ProductInventory_ProductID_LocationID | ON ProductID, LocationID | Clustered index created by a primary key constraint. | |
| Foreign Keys | |||
| FK_ProductInventory_Location_LocationID | ( LocationID ) ref Location (LocationID) | Foreign key constraint referencing Location.LocationID. | |
| FK_ProductInventory_Product_ProductID | ( ProductID ) ref Product (ProductID) | Foreign key constraint referencing Product.ProductID. | |
| Constraints | |||
| CK_ProductInventory_Shelf | [Shelf] like '[A-Za-z]' OR [Shelf]='N/A' | ||
| CK_ProductInventory_Bin | [Bin]>=(0) AND [Bin]<=(100) | ||
Changes in the list price of a product over time.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | ProductID | int | Product identification number. Foreign key to Product.ProductID |
| * | StartDate | datetime | List price start date. |
| EndDate | datetime | List price end date | |
| * | ListPrice | money | Product list price. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_ProductListPriceHistory_ProductID_StartDate | ON ProductID, StartDate | Clustered index created by a primary key constraint. | |
| Foreign Keys | |||
| FK_ProductListPriceHistory_Product_ProductID | ( ProductID ) ref Product (ProductID) | Foreign key constraint referencing Product.ProductID. | |
| Constraints | |||
| CK_ProductListPriceHistory_EndDate | [EndDate]>=[StartDate] OR [EndDate] IS NULL | ||
| CK_ProductListPriceHistory_EndDate | [EndDate]>=[StartDate] OR [EndDate] IS NULL | ||
| CK_ProductListPriceHistory_ListPrice | [ListPrice]>(0.00) | ||
Product model classification.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | ProductModelID | int AUTOINCREMENT | Primary key for ProductModel records. |
| * | Name | name | Product model description. |
| CatalogDescription | xml | Detailed product catalog information in xml format. | |
| Instructions | xml | Manufacturing instructions in xml format. | |
| * | 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_ProductModel_ProductModelID | ON ProductModelID | Clustered index created by a primary key constraint. | |
| AK_ProductModel_Name | ON Name | Unique nonclustered index. | |
| AK_ProductModel_rowguid | ON rowguid | Unique nonclustered index. Used to support replication samples. | |
Cross-reference table mapping product models and illustrations.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | ProductModelID | int | Primary key. Foreign key to ProductModel.ProductModelID. |
| * | IllustrationID | int | Primary key. Foreign key to Illustration.IllustrationID. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_ProductModelIllustration_ProductModelID_IllustrationID | ON ProductModelID, IllustrationID | Clustered index created by a primary key constraint. | |
| Foreign Keys | |||
| FK_ProductModelIllustration_Illustration_IllustrationID | ( IllustrationID ) ref Illustration (IllustrationID) | Foreign key constraint referencing Illustration.IllustrationID. | |
| FK_ProductModelIllustration_ProductModel_ProductModelID | ( ProductModelID ) ref ProductModel (ProductModelID) | Foreign key constraint referencing ProductModel.ProductModelID. | |
Cross-reference table mapping product descriptions and the language the description is written in.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | ProductModelID | int | Primary key. Foreign key to ProductModel.ProductModelID. |
| * | ProductDescriptionID | int | Primary key. Foreign key to ProductDescription.ProductDescriptionID. |
| * | CultureID | nchar(6) | Culture identification number. Foreign key to Culture.CultureID. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_ProductModelProductDescriptionCulture_ProductModelID_ProductDescriptionID_CultureID | ON ProductModelID, ProductDescriptionID, CultureID | Clustered index created by a primary key constraint. | |
| Foreign Keys | |||
| FK_ProductModelProductDescriptionCulture_Culture_CultureID | ( CultureID ) ref Culture (CultureID) | Foreign key constraint referencing Culture.CultureID. | |
| FK_ProductModelProductDescriptionCulture_ProductDescription_ProductDescriptionID | ( ProductDescriptionID ) ref ProductDescription (ProductDescriptionID) | Foreign key constraint referencing ProductDescription.ProductDescriptionID. | |
| FK_ProductModelProductDescriptionCulture_ProductModel_ProductModelID | ( ProductModelID ) ref ProductModel (ProductModelID) | Foreign key constraint referencing ProductModel.ProductModelID. | |
Product images.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | ProductPhotoID | int AUTOINCREMENT | Primary key for ProductPhoto records. |
| ThumbNailPhoto | varbinary(max) | Small image of the product. | |
| ThumbnailPhotoFileName | nvarchar(50) | Small image file name. | |
| LargePhoto | varbinary(max) | Large image of the product. | |
| LargePhotoFileName | nvarchar(50) | Large image file name. | |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_ProductPhoto_ProductPhotoID | ON ProductPhotoID | Clustered index created by a primary key constraint. | |
Cross-reference table mapping products and product photos.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | ProductID | int | Product identification number. Foreign key to Product.ProductID. |
| * | ProductPhotoID | int | Product photo identification number. Foreign key to ProductPhoto.ProductPhotoID. |
| * | Primary | flag DEFAULT 0 | 0 = Photo is not the principal image. 1 = Photo is the principal image. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_ProductProductPhoto_ProductID_ProductPhotoID | ON ProductID, ProductPhotoID | Nonclustered index created by a primary key constraint. | |
| Foreign Keys | |||
| FK_ProductProductPhoto_Product_ProductID | ( ProductID ) ref Product (ProductID) | Foreign key constraint referencing Product.ProductID. | |
| FK_ProductProductPhoto_ProductPhoto_ProductPhotoID | ( ProductPhotoID ) ref ProductPhoto (ProductPhotoID) | Foreign key constraint referencing ProductPhoto.ProductPhotoID. | |
Customer reviews of products they have purchased.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | ProductReviewID | int AUTOINCREMENT | Primary key for ProductReview records. |
| * | ProductID | int | Product identification number. Foreign key to Product.ProductID. |
| * | ReviewerName | name | Name of the reviewer. |
| * | ReviewDate | datetime DEFAULT getdate() | Date review was submitted. |
| * | EmailAddress | nvarchar(50) | Reviewer's e-mail address. |
| * | Rating | int | Product rating given by the reviewer. Scale is 1 to 5 with 5 as the highest rating. |
| Comments | nvarchar(3850) | Reviewer's comments | |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_ProductReview_ProductReviewID | ON ProductReviewID | Clustered index created by a primary key constraint. | |
| IX_ProductReview_ProductID_Name | ON ProductID, ReviewerName | Nonclustered index. | |
| Foreign Keys | |||
| FK_ProductReview_Product_ProductID | ( ProductID ) ref Product (ProductID) | Foreign key constraint referencing Product.ProductID. | |
| Constraints | |||
| CK_ProductReview_Rating | [Rating]>=(1) AND [Rating]<=(5) | ||
Product subcategories. See ProductCategory table.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | ProductSubcategoryID | int AUTOINCREMENT | Primary key for ProductSubcategory records. |
| * | ProductCategoryID | int | Product category identification number. Foreign key to ProductCategory.ProductCategoryID. |
| * | Name | name | Subcategory 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_ProductSubcategory_ProductSubcategoryID | ON ProductSubcategoryID | Clustered index created by a primary key constraint. | |
| AK_ProductSubcategory_Name | ON Name | Unique nonclustered index. | |
| AK_ProductSubcategory_rowguid | ON rowguid | Unique nonclustered index. Used to support replication samples. | |
| Foreign Keys | |||
| FK_ProductSubcategory_ProductCategory_ProductCategoryID | ( ProductCategoryID ) ref ProductCategory (ProductCategoryID) | Foreign key constraint referencing ProductCategory.ProductCategoryID. | |
Cross-reference table mapping vendors with the products they supply.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | ProductID | int | Primary key. Foreign key to Product.ProductID. |
| * | BusinessEntityID | int | Primary key. Foreign key to Vendor.BusinessEntityID. |
| * | AverageLeadTime | int | The average span of time (in days) between placing an order with the vendor and receiving the purchased product. |
| * | StandardPrice | money | The vendor's usual selling price. |
| LastReceiptCost | money | The selling price when last purchased. | |
| LastReceiptDate | datetime | Date the product was last received by the vendor. | |
| * | MinOrderQty | int | The maximum quantity that should be ordered. |
| * | MaxOrderQty | int | The minimum quantity that should be ordered. |
| OnOrderQty | int | The quantity currently on order. | |
| * | UnitMeasureCode | nchar(3) | The product's unit of measure. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_ProductVendor_ProductID_BusinessEntityID | ON ProductID, BusinessEntityID | Clustered index created by a primary key constraint. | |
| IX_ProductVendor_BusinessEntityID | ON BusinessEntityID | Nonclustered index. | |
| IX_ProductVendor_UnitMeasureCode | ON UnitMeasureCode | Nonclustered index. | |
| Foreign Keys | |||
| FK_ProductVendor_Product_ProductID | ( ProductID ) ref Product (ProductID) | Foreign key constraint referencing Product.ProductID. | |
| FK_ProductVendor_UnitMeasure_UnitMeasureCode | ( UnitMeasureCode ) ref UnitMeasure (UnitMeasureCode) | Foreign key constraint referencing UnitMeasure.UnitMeasureCode. | |
| FK_ProductVendor_Vendor_BusinessEntityID | ( BusinessEntityID ) ref Vendor (BusinessEntityID) | Foreign key constraint referencing Vendor.BusinessEntityID. | |
| Constraints | |||
| CK_ProductVendor_AverageLeadTime | [AverageLeadTime]>=(1) | ||
| CK_ProductVendor_StandardPrice | [StandardPrice]>(0.00) | ||
| CK_ProductVendor_LastReceiptCost | [LastReceiptCost]>(0.00) | ||
| CK_ProductVendor_MinOrderQty | [MinOrderQty]>=(1) | ||
| CK_ProductVendor_MaxOrderQty | [MaxOrderQty]>=(1) | ||
| CK_ProductVendor_OnOrderQty | [OnOrderQty]>=(0) | ||
Individual products associated with a specific purchase order. See PurchaseOrderHeader.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | PurchaseOrderID | int | Primary key. Foreign key to PurchaseOrderHeader.PurchaseOrderID. |
| * | PurchaseOrderDetailID | int AUTOINCREMENT | Primary key. One line number per purchased product. |
| * | DueDate | datetime | Date the product is expected to be received. |
| * | OrderQty | smallint | Quantity ordered. |
| * | ProductID | int | Product identification number. Foreign key to Product.ProductID. |
| * | UnitPrice | money | Vendor's selling price of a single product. |
| * | LineTotal | money | Per product subtotal. Computed as OrderQty * UnitPrice. |
| * | ReceivedQty | decimal(8,2) | Quantity actually received from the vendor. |
| * | RejectedQty | decimal(8,2) | Quantity rejected during inspection. |
| * | StockedQty | decimal(9,2) | Quantity accepted into inventory. Computed as ReceivedQty - RejectedQty. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_PurchaseOrderDetail_PurchaseOrderID_PurchaseOrderDetailID | ON PurchaseOrderID, PurchaseOrderDetailID | Clustered index created by a primary key constraint. | |
| IX_PurchaseOrderDetail_ProductID | ON ProductID | Nonclustered index. | |
| Foreign Keys | |||
| FK_PurchaseOrderDetail_Product_ProductID | ( ProductID ) ref Product (ProductID) | Foreign key constraint referencing Product.ProductID. | |
| FK_PurchaseOrderDetail_PurchaseOrderHeader_PurchaseOrderID | ( PurchaseOrderID ) ref PurchaseOrderHeader (PurchaseOrderID) | Foreign key constraint referencing PurchaseOrderHeader.PurchaseOrderID. | |
| Constraints | |||
| CK_PurchaseOrderDetail_OrderQty | [OrderQty]>(0) | ||
| CK_PurchaseOrderDetail_UnitPrice | [UnitPrice]>=(0.00) | ||
| CK_PurchaseOrderDetail_ReceivedQty | [ReceivedQty]>=(0.00) | ||
| CK_PurchaseOrderDetail_RejectedQty | [RejectedQty]>=(0.00) | ||
| Triggers | |||
| iPurchaseOrderDetail | |||
| uPurchaseOrderDetail | |||
General purchase order information. See PurchaseOrderDetail.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | PurchaseOrderID | int AUTOINCREMENT | Primary key. |
| * | RevisionNumber | tinyint DEFAULT 0 | Incremental number to track changes to the purchase order over time. |
| * | Status | tinyint DEFAULT 1 | Order current status. 1 = Pending; 2 = Approved; 3 = Rejected; 4 = Complete |
| * | EmployeeID | int | Employee who created the purchase order. Foreign key to Employee.BusinessEntityID. |
| * | VendorID | int | Vendor with whom the purchase order is placed. Foreign key to Vendor.BusinessEntityID. |
| * | ShipMethodID | int | Shipping method. Foreign key to ShipMethod.ShipMethodID. |
| * | OrderDate | datetime DEFAULT getdate() | Purchase order creation date. |
| ShipDate | datetime | Estimated shipment date from the vendor. | |
| * | SubTotal | money DEFAULT 0.00 | Purchase order subtotal. Computed as SUM(PurchaseOrderDetail.LineTotal)for the appropriate PurchaseOrderID. |
| * | TaxAmt | money DEFAULT 0.00 | Tax amount. |
| * | Freight | money DEFAULT 0.00 | Shipping cost. |
| * | TotalDue | money | Total due to vendor. Computed as Subtotal + TaxAmt + Freight. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_PurchaseOrderHeader_PurchaseOrderID | ON PurchaseOrderID | Clustered index created by a primary key constraint. | |
| IX_PurchaseOrderHeader_EmployeeID | ON EmployeeID | Nonclustered index. | |
| IX_PurchaseOrderHeader_VendorID | ON VendorID | Nonclustered index. | |
| Foreign Keys | |||
| FK_PurchaseOrderHeader_Employee_EmployeeID | ( EmployeeID ) ref Employee (BusinessEntityID) | Foreign key constraint referencing Employee.EmployeeID. | |
| FK_PurchaseOrderHeader_ShipMethod_ShipMethodID | ( ShipMethodID ) ref ShipMethod (ShipMethodID) | Foreign key constraint referencing ShipMethod.ShipMethodID. | |
| FK_PurchaseOrderHeader_Vendor_VendorID | ( VendorID ) ref Vendor (BusinessEntityID) | Foreign key constraint referencing Vendor.VendorID. | |
| Constraints | |||
| CK_PurchaseOrderHeader_Status | [Status]>=(1) AND [Status]<=(4) | ||
| CK_PurchaseOrderHeader_ShipDate | [ShipDate]>=[OrderDate] OR [ShipDate] IS NULL | ||
| CK_PurchaseOrderHeader_ShipDate | [ShipDate]>=[OrderDate] OR [ShipDate] IS NULL | ||
| CK_PurchaseOrderHeader_SubTotal | [SubTotal]>=(0.00) | ||
| CK_PurchaseOrderHeader_TaxAmt | [TaxAmt]>=(0.00) | ||
| CK_PurchaseOrderHeader_Freight | [Freight]>=(0.00) | ||
| Triggers | |||
| uPurchaseOrderHeader | |||
Individual products associated with a specific sales order. See SalesOrderHeader.
| Idx | 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.
| Idx | 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.
| Idx | 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.
| Idx | 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.
| Idx | 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.
| Idx | 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.
| Idx | 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.
| Idx | 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.
| Idx | 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 | ||
Manufacturing failure reasons lookup table.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | ScrapReasonID | smallint AUTOINCREMENT | Primary key for ScrapReason records. |
| * | Name | name | Failure description. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_ScrapReason_ScrapReasonID | ON ScrapReasonID | Clustered index created by a primary key constraint. | |
| AK_ScrapReason_Name | ON Name | Unique nonclustered index. | |
Work shift lookup table.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | ShiftID | tinyint AUTOINCREMENT | Primary key for Shift records. |
| * | Name | name | Shift description. |
| * | StartTime | time(16) | Shift start time. |
| * | EndTime | time(16) | Shift end time. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_Shift_ShiftID | ON ShiftID | Clustered index created by a primary key constraint. | |
| AK_Shift_Name | ON Name | Unique nonclustered index. | |
| AK_Shift_StartTime_EndTime | ON StartTime, EndTime | Unique nonclustered index. | |
Shipping company lookup table.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | ShipMethodID | int AUTOINCREMENT | Primary key for ShipMethod records. |
| * | Name | name | Shipping company name. |
| * | ShipBase | money DEFAULT 0.00 | Minimum shipping charge. |
| * | ShipRate | money DEFAULT 0.00 | Shipping charge per pound. |
| * | 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_ShipMethod_ShipMethodID | ON ShipMethodID | Clustered index created by a primary key constraint. | |
| AK_ShipMethod_Name | ON Name | Unique nonclustered index. | |
| AK_ShipMethod_rowguid | ON rowguid | Unique nonclustered index. Used to support replication samples. | |
| Constraints | |||
| CK_ShipMethod_ShipBase | [ShipBase]>(0.00) | ||
| CK_ShipMethod_ShipRate | [ShipRate]>(0.00) | ||
Contains online customer orders until the order is submitted or cancelled.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | ShoppingCartItemID | int AUTOINCREMENT | Primary key for ShoppingCartItem records. |
| * | ShoppingCartID | nvarchar(50) | Shopping cart identification number. |
| * | Quantity | int DEFAULT 1 | Product quantity ordered. |
| * | ProductID | int | Product ordered. Foreign key to Product.ProductID. |
| * | DateCreated | datetime DEFAULT getdate() | Date the time the record was created. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_ShoppingCartItem_ShoppingCartItemID | ON ShoppingCartItemID | Clustered index created by a primary key constraint. | |
| IX_ShoppingCartItem_ShoppingCartID_ProductID | ON ShoppingCartID, ProductID | Nonclustered index. | |
| Foreign Keys | |||
| FK_ShoppingCartItem_Product_ProductID | ( ProductID ) ref Product (ProductID) | Foreign key constraint referencing Product.ProductID. | |
| Constraints | |||
| CK_ShoppingCartItem_Quantity | [Quantity]>=(1) | ||
Sale discounts lookup table.
| Idx | 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.
| Idx | 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. | |
State and province lookup table.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | StateProvinceID | int AUTOINCREMENT | Primary key for StateProvince records. |
| * | StateProvinceCode | nchar(3) | ISO standard state or province code. |
| * | CountryRegionCode | nvarchar(3) | ISO standard country or region code. Foreign key to CountryRegion.CountryRegionCode. |
| * | IsOnlyStateProvinceFlag | flag DEFAULT 1 | 0 = StateProvinceCode exists. 1 = StateProvinceCode unavailable, using CountryRegionCode. |
| * | Name | name | State or province description. |
| * | TerritoryID | int | ID of the territory in which the state or province is located. Foreign key to SalesTerritory.SalesTerritoryID. |
| * | 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_StateProvince_StateProvinceID | ON StateProvinceID | Clustered index created by a primary key constraint. | |
| AK_StateProvince_Name | ON Name | Unique nonclustered index. | |
| AK_StateProvince_rowguid | ON rowguid | Unique nonclustered index. Used to support replication samples. | |
| AK_StateProvince_StateProvinceCode_CountryRegionCode | ON StateProvinceCode, CountryRegionCode | Unique nonclustered index. | |
| Foreign Keys | |||
| FK_StateProvince_CountryRegion_CountryRegionCode | ( CountryRegionCode ) ref CountryRegion (CountryRegionCode) | Foreign key constraint referencing CountryRegion.CountryRegionCode. | |
| FK_StateProvince_SalesTerritory_TerritoryID | ( TerritoryID ) ref SalesTerritory (TerritoryID) | Foreign key constraint referencing SalesTerritory.TerritoryID. | |
Customers (resellers) of Adventure Works products.
| Idx | 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 | |
Record of each purchase order, sales order, or work order transaction year to date.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | TransactionID | int AUTOINCREMENT | Primary key for TransactionHistory records. |
| * | ProductID | int | Product identification number. Foreign key to Product.ProductID. |
| * | ReferenceOrderID | int | Purchase order, sales order, or work order identification number. |
| * | ReferenceOrderLineID | int DEFAULT 0 | Line number associated with the purchase order, sales order, or work order. |
| * | TransactionDate | datetime DEFAULT getdate() | Date and time of the transaction. |
| * | TransactionType | nchar(1) | W = WorkOrder, S = SalesOrder, P = PurchaseOrder |
| * | Quantity | int | Product quantity. |
| * | ActualCost | money | Product cost. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_TransactionHistory_TransactionID | ON TransactionID | Clustered index created by a primary key constraint. | |
| IX_TransactionHistory_ProductID | ON ProductID | Nonclustered index. | |
| IX_TransactionHistory_ReferenceOrderID_ReferenceOrderLineID | ON ReferenceOrderID, ReferenceOrderLineID | Nonclustered index. | |
| Foreign Keys | |||
| FK_TransactionHistory_Product_ProductID | ( ProductID ) ref Product (ProductID) | Foreign key constraint referencing Product.ProductID. | |
| Constraints | |||
| CK_TransactionHistory_TransactionType | upper([TransactionType])='P' OR upper([TransactionType])='S' OR upper([TransactionType])='W' | ||
Transactions for previous years.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | TransactionID | int | Primary key for TransactionHistoryArchive records. |
| * | ProductID | int | Product identification number. Foreign key to Product.ProductID. |
| * | ReferenceOrderID | int | Purchase order, sales order, or work order identification number. |
| * | ReferenceOrderLineID | int DEFAULT 0 | Line number associated with the purchase order, sales order, or work order. |
| * | TransactionDate | datetime DEFAULT getdate() | Date and time of the transaction. |
| * | TransactionType | nchar(1) | W = Work Order, S = Sales Order, P = Purchase Order |
| * | Quantity | int | Product quantity. |
| * | ActualCost | money | Product cost. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_TransactionHistoryArchive_TransactionID | ON TransactionID | Clustered index created by a primary key constraint. | |
| IX_TransactionHistoryArchive_ProductID | ON ProductID | Nonclustered index. | |
| IX_TransactionHistoryArchive_ReferenceOrderID_ReferenceOrderLineID | ON ReferenceOrderID, ReferenceOrderLineID | Nonclustered index. | |
| Constraints | |||
| CK_TransactionHistoryArchive_TransactionType | upper([TransactionType])='P' OR upper([TransactionType])='S' OR upper([TransactionType])='W' | ||
Unit of measure lookup table.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | UnitMeasureCode | nchar(3) | Primary key. |
| * | Name | name | Unit of measure description. |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_UnitMeasure_UnitMeasureCode | ON UnitMeasureCode | Clustered index created by a primary key constraint. | |
| AK_UnitMeasure_Name | ON Name | Unique nonclustered index. | |
Companies from whom Adventure Works Cycles purchases parts or other goods.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | BusinessEntityID | int | Primary key for Vendor records. Foreign key to BusinessEntity.BusinessEntityID |
| * | AccountNumber | accountnumber | Vendor account (identification) number. |
| * | Name | name | Company name. |
| * | CreditRating | tinyint | 1 = Superior, 2 = Excellent, 3 = Above average, 4 = Average, 5 = Below average |
| * | PreferredVendorStatus | flag DEFAULT 1 | 0 = Do not use if another vendor is available. 1 = Preferred over other vendors supplying the same product. |
| * | ActiveFlag | flag DEFAULT 1 | 0 = Vendor no longer used. 1 = Vendor is actively used. |
| PurchasingWebServiceURL | nvarchar(1024) | Vendor URL. | |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_Vendor_BusinessEntityID | ON BusinessEntityID | Clustered index created by a primary key constraint. | |
| AK_Vendor_AccountNumber | ON AccountNumber | Unique nonclustered index. | |
| Foreign Keys | |||
| FK_Vendor_BusinessEntity_BusinessEntityID | ( BusinessEntityID ) ref BusinessEntity (BusinessEntityID) | Foreign key constraint referencing BusinessEntity.BusinessEntityID | |
| Constraints | |||
| CK_Vendor_CreditRating | [CreditRating]>=(1) AND [CreditRating]<=(5) | ||
| Triggers | |||
| dVendor | |||
Manufacturing work orders.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | WorkOrderID | int AUTOINCREMENT | Primary key for WorkOrder records. |
| * | ProductID | int | Product identification number. Foreign key to Product.ProductID. |
| * | OrderQty | int | Product quantity to build. |
| * | StockedQty | int | Quantity built and put in inventory. |
| * | ScrappedQty | smallint | Quantity that failed inspection. |
| * | StartDate | datetime | Work order start date. |
| EndDate | datetime | Work order end date. | |
| * | DueDate | datetime | Work order due date. |
| ScrapReasonID | smallint | Reason for inspection failure. | |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_WorkOrder_WorkOrderID | ON WorkOrderID | Clustered index created by a primary key constraint. | |
| IX_WorkOrder_ProductID | ON ProductID | Nonclustered index. | |
| IX_WorkOrder_ScrapReasonID | ON ScrapReasonID | Nonclustered index. | |
| Foreign Keys | |||
| FK_WorkOrder_Product_ProductID | ( ProductID ) ref Product (ProductID) | Foreign key constraint referencing Product.ProductID. | |
| FK_WorkOrder_ScrapReason_ScrapReasonID | ( ScrapReasonID ) ref ScrapReason (ScrapReasonID) | Foreign key constraint referencing ScrapReason.ScrapReasonID. | |
| Constraints | |||
| CK_WorkOrder_OrderQty | [OrderQty]>(0) | ||
| CK_WorkOrder_ScrappedQty | [ScrappedQty]>=(0) | ||
| CK_WorkOrder_EndDate | [EndDate]>=[StartDate] OR [EndDate] IS NULL | ||
| CK_WorkOrder_EndDate | [EndDate]>=[StartDate] OR [EndDate] IS NULL | ||
| Triggers | |||
| iWorkOrder | |||
| uWorkOrder | |||
Work order details.
| Idx | Field Name | Data Type | Description |
|---|---|---|---|
| * | WorkOrderID | int | Primary key. Foreign key to WorkOrder.WorkOrderID. |
| * | ProductID | int | Primary key. Foreign key to Product.ProductID. |
| * | OperationSequence | smallint | Primary key. Indicates the manufacturing process sequence. |
| * | LocationID | smallint | Manufacturing location where the part is processed. Foreign key to Location.LocationID. |
| * | ScheduledStartDate | datetime | Planned manufacturing start date. |
| * | ScheduledEndDate | datetime | Planned manufacturing end date. |
| ActualStartDate | datetime | Actual start date. | |
| ActualEndDate | datetime | Actual end date. | |
| ActualResourceHrs | decimal(9,4) | Number of manufacturing hours used. | |
| * | PlannedCost | money | Estimated manufacturing cost. |
| ActualCost | money | Actual manufacturing cost. | |
| * | ModifiedDate | datetime DEFAULT getdate() | Date and time the record was last updated. |
| Indexes | |||
| PK_WorkOrderRouting_WorkOrderID_ProductID_OperationSequence | ON WorkOrderID, ProductID, OperationSequence | Clustered index created by a primary key constraint. | |
| IX_WorkOrderRouting_ProductID | ON ProductID | Nonclustered index. | |
| Foreign Keys | |||
| FK_WorkOrderRouting_Location_LocationID | ( LocationID ) ref Location (LocationID) | Foreign key constraint referencing Location.LocationID. | |
| FK_WorkOrderRouting_WorkOrder_WorkOrderID | ( WorkOrderID ) ref WorkOrder (WorkOrderID) | Foreign key constraint referencing WorkOrder.WorkOrderID. | |
| Constraints | |||
| CK_WorkOrderRouting_ScheduledEndDate | [ScheduledEndDate]>=[ScheduledStartDate] | ||
| CK_WorkOrderRouting_ScheduledEndDate | [ScheduledEndDate]>=[ScheduledStartDate] | ||
| CK_WorkOrderRouting_ActualEndDate | [ActualEndDate]>=[ActualStartDate] OR [ActualEndDate] IS NULL OR [ActualStartDate] IS NULL | ||
| CK_WorkOrderRouting_ActualEndDate | [ActualEndDate]>=[ActualStartDate] OR [ActualEndDate] IS NULL OR [ActualStartDate] IS NULL | ||
| CK_WorkOrderRouting_ActualResourceHrs | [ActualResourceHrs]>=(0.0000) | ||
| CK_WorkOrderRouting_PlannedCost | [PlannedCost]>(0.00) | ||
| CK_WorkOrderRouting_ActualCost | [ActualCost]>(0.00) | ||