AdventureWorks
Production.Product Table
Description
Products sold or used in the manfacturing of sold products.
Properties
Creation Date08/01/2010 08:40
File GroupPRIMARY
Text File Group
System Object
Published for Replication
Rows504
Data Space Used104.00 KB
Index Space Used120.00 KB
Columns
 Column NameDescriptionDatatypeLengthAllow NullsDefaultFormula
Primary Key ProductIDPrimary key for Product records.int4   
 NameName of the product.dbo.Name50   
 ProductNumberUnique product identification number.nvarchar25   
 MakeFlag0 = Product is purchased, 1 = Product is manufactured in-house.dbo.Flag1 
((1))
 
 FinishedGoodsFlag0 = Product is not a salable item. 1 = Product is salable.dbo.Flag1 
((1))
 
 ColorProduct color.nvarchar15  
 SafetyStockLevelMinimum inventory quantity. smallint2   
 ReorderPointInventory level that triggers a purchase order or work order. smallint2   
 StandardCostStandard cost of the product.money8   
 ListPriceSelling price.money8   
 SizeProduct size.nvarchar5  
 SizeUnitMeasureCodeUnit of measure for Size column.nchar3  
 WeightUnitMeasureCodeUnit of measure for Weight column.nchar3  
 WeightProduct weight.decimal9 (8,2)  
 DaysToManufactureNumber of days required to manufacture the product.int4   
 ProductLineR = Road, M = Mountain, T = Touring, S = Standardnchar2  
 ClassH = High, M = Medium, L = Lownchar2  
 StyleW = Womens, M = Mens, U = Universalnchar2  
 ProductSubcategoryIDProduct is a member of this product subcategory. Foreign key to ProductSubCategory.ProductSubCategoryID. int4  
 ProductModelIDProduct is a member of this product model. Foreign key to ProductModel.ProductModelID.int4  
 SellStartDateDate the product was available for sale.datetime4   
 SellEndDateDate the product was no longer available for sale.datetime4  
 DiscontinuedDateDate the product was discontinued.datetime4  
 rowguidROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.uniqueidentifier16 
(newid())
 
 ModifiedDateDate and time the record was last updated.datetime4 
(getdate())
 
Indexes
IndexDescriptionPrimaryUnique
AK_Product_NameUnique nonclustered index. 
AK_Product_ProductNumberUnique nonclustered index. 
AK_Product_rowguidUnique nonclustered index. Used to support replication samples. 
PK_Product_ProductIDPrimary key (clustered) constraint
Check Constraints
NameDescriptionExpression
CK_Product_ClassCheck constraint [Class]='h' OR [Class]='m' OR [Class]='l' OR [Class]='H' OR [Class]='M' OR [Class]='L' OR [Class] IS NULL
(upper([Class])='H' OR upper([Class])='M' OR upper([Class])='L' OR [Class] IS NULL)
CK_Product_DaysToManufactureCheck constraint [DaysToManufacture] >= (0)
([DaysToManufacture]>=(0))
CK_Product_ListPriceCheck constraint [ListPrice] >= (0.00)
([ListPrice]>=(0.00))
CK_Product_ProductLineCheck constraint [ProductLine]='r' OR [ProductLine]='m' OR [ProductLine]='t' OR [ProductLine]='s' OR [ProductLine]='R' OR [ProductLine]='M' OR [ProductLine]='T' OR [ProductLine]='S' OR [ProductLine] IS NULL
(upper([ProductLine])='R' OR upper([ProductLine])='M' OR upper([ProductLine])='T' OR upper([ProductLine])='S' OR [ProductLine] IS NULL)
CK_Product_ReorderPointCheck constraint [ReorderPoint] > (0)
([ReorderPoint]>(0))
CK_Product_SafetyStockLevelCheck constraint [SafetyStockLevel] > (0)
([SafetyStockLevel]>(0))
CK_Product_SellEndDateCheck constraint [SellEndDate] >= [SellStartDate] OR [SellEndDate] IS NULL
([SellEndDate]>=[SellStartDate] OR [SellEndDate] IS NULL)
CK_Product_StandardCostCheck constraint [SafetyStockLevel] > (0)
([StandardCost]>=(0.00))
CK_Product_StyleCheck constraint [Style]='u' OR [Style]='m' OR [Style]='w' OR [Style]='U' OR [Style]='M' OR [Style]='W' OR [Style] IS NULL
(upper([Style])='U' OR upper([Style])='M' OR upper([Style])='W' OR [Style] IS NULL)
CK_Product_WeightCheck constraint [Weight] > (0.00)
([Weight]>(0.00))
Relationships
RelationshipDescription
FK_BillOfMaterials_Product_ComponentIDForeign key constraint referencing Product.ComponentID.
FK_BillOfMaterials_Product_ProductAssemblyIDForeign key constraint referencing Product.ProductAssemblyID.
FK_Product_ProductModel_ProductModelIDForeign key constraint referencing ProductModel.ProductModelID.
FK_Product_ProductSubcategory_ProductSubcategoryIDForeign key constraint referencing ProductSubcategory.ProductSubcategoryID.
FK_Product_UnitMeasure_SizeUnitMeasureCodeForeign key constraint referencing UnitMeasure.UnitMeasureCode.
FK_Product_UnitMeasure_WeightUnitMeasureCodeForeign key constraint referencing UnitMeasure.UnitMeasureCode.
FK_ProductCostHistory_Product_ProductIDForeign key constraint referencing Product.ProductID.
FK_ProductDocument_Product_ProductIDForeign key constraint referencing Product.ProductID.
FK_ProductInventory_Product_ProductIDForeign key constraint referencing Product.ProductID.
FK_ProductListPriceHistory_Product_ProductIDForeign key constraint referencing Product.ProductID.
FK_ProductProductPhoto_Product_ProductIDForeign key constraint referencing Product.ProductID.
FK_ProductReview_Product_ProductIDForeign key constraint referencing Product.ProductID.
FK_ProductVendor_Product_ProductIDForeign key constraint referencing Product.ProductID.
FK_PurchaseOrderDetail_Product_ProductIDForeign key constraint referencing Product.ProductID.
FK_ShoppingCartItem_Product_ProductIDForeign key constraint referencing Product.ProductID.
FK_SpecialOfferProduct_Product_ProductIDForeign key constraint referencing Product.ProductID.
FK_TransactionHistory_Product_ProductIDForeign key constraint referencing Product.ProductID.
FK_WorkOrder_Product_ProductIDForeign key constraint referencing Product.ProductID.
Objects that depend on Production.Product
 Database ObjectObject TypeDescriptionDep Level
Production.BillOfMaterials tableProduction.BillOfMaterialsTableItems required to make bicycles and bicycle subassemblies. It identifies the heirarchical relationship between a parent product and its components.1
iduSalesOrderDetail triggeriduSalesOrderDetailTriggerAFTER INSERT, DELETE, UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in SalesOrderDetail and updates the SalesOrderHeader.SubTotal column.3
iPurchaseOrderDetail triggeriPurchaseOrderDetailTriggerAFTER INSERT trigger that inserts a row in the TransactionHistory table and updates the PurchaseOrderHeader.SubTotal column.2
iWorkOrder triggeriWorkOrderTriggerAFTER INSERT trigger that inserts a row in the TransactionHistory table.2
Production.ProductCostHistory tableProduction.ProductCostHistoryTableChanges in the cost of a product over time.1
Production.ProductDocument tableProduction.ProductDocumentTableCross-reference table mapping products to related product documents.1
Production.ProductInventory tableProduction.ProductInventoryTableProduct inventory information.1
Production.ProductListPriceHistory tableProduction.ProductListPriceHistoryTableChanges in the list price of a product over time.1
Production.ProductProductPhoto tableProduction.ProductProductPhotoTableCross-reference table mapping products and product photos.1
Production.ProductReview tableProduction.ProductReviewTableCustomer reviews of products they have purchased.1
Purchasing.ProductVendor tablePurchasing.ProductVendorTableCross-reference table mapping vendors with the products they supply.1
Purchasing.PurchaseOrderDetail tablePurchasing.PurchaseOrderDetailTableIndividual products associated with a specific purchase order. See PurchaseOrderHeader.1
Sales.SalesOrderDetail tableSales.SalesOrderDetailTableIndividual products associated with a specific sales order. See SalesOrderHeader.2
Sales.ShoppingCartItem tableSales.ShoppingCartItemTableContains online customer orders until the order is submitted or cancelled.1
Sales.SpecialOfferProduct tableSales.SpecialOfferProductTableCross-reference table mapping products to special offer discounts.1
Production.TransactionHistory tableProduction.TransactionHistoryTableRecord of each purchase order, sales order, or work order transaction year to date.1
dbo.ufnGetProductDealerPrice functiondbo.ufnGetProductDealerPriceUser Defined FunctionScalar function returning the dealer price for a given product on a particular order date.1
dbo.ufnGetProductListPrice functiondbo.ufnGetProductListPriceUser Defined FunctionScalar function returning the list price for a given product on a particular order date.1
dbo.ufnGetProductStandardCost functiondbo.ufnGetProductStandardCostUser Defined FunctionScalar function returning the standard cost for a given product on a particular order date.1
dbo.ufnGetStock functiondbo.ufnGetStockUser Defined FunctionScalar function returning the quantity of inventory in LocationID 6 (Miscellaneous Storage)for a specified ProductID.2
uPurchaseOrderDetail triggeruPurchaseOrderDetailTriggerAFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in PurchaseOrderDetail and updates the PurchaseOrderHeader.SubTotal column.2
dbo.uspGetBillOfMaterials proceduredbo.uspGetBillOfMaterialsStored ProcedureDescription for uspGetBillOfMaterials in TSQLStored procedure using a recursive query to return a multi-level bill of material for the specified ProductID.1
dbo.uspGetWhereUsedProductID proceduredbo.uspGetWhereUsedProductIDStored ProcedureStored procedure using a recursive query to return all components or assemblies that directly or indirectly use the specified ProductID.1
uWorkOrder triggeruWorkOrderTriggerAFTER UPDATE trigger that inserts a row in the TransactionHistory table, updates ModifiedDate in the WorkOrder table.2
Production.vProductAndDescription viewProduction.vProductAndDescriptionViewProduct names and descriptions. Product descriptions are provided in multiple languages.1
Production.WorkOrder tableProduction.WorkOrderTableManufacturing work orders.1
Production.WorkOrderRouting tableProduction.WorkOrderRoutingTableWork order details.2
Objects that Production.Product depends on
 Database ObjectObject TypeDescriptionDep Level
dbo.Flag datatypedbo.FlagUser Defined Data Type 1
dbo.Name datatypedbo.NameUser Defined Data Type 1
Production.ProductCategory tableProduction.ProductCategoryTableHigh-level product categorization.2
Production.ProductModel tableProduction.ProductModelTableProduct model classification.1
Production.ProductSubcategory tableProduction.ProductSubcategoryTableProduct subcategories. See ProductCategory table.1
Production.UnitMeasure tableProduction.UnitMeasureTableUnit of measure lookup table.1
SQL
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
CREATE TABLE [Production].[Product](
	[ProductID] [int] IDENTITY(1,1) NOT NULL,
	[Name] [dbo].[Name] NOT NULL,
	[ProductNumber] [nvarchar](25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
	[MakeFlag] [dbo].[Flag] NOT NULL,
	[FinishedGoodsFlag] [dbo].[Flag] NOT NULL,
	[Color] [nvarchar](15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[SafetyStockLevel] [smallint] NOT NULL,
	[ReorderPoint] [smallint] NOT NULL,
	[StandardCost] [money] NOT NULL,
	[ListPrice] [money] NOT NULL,
	[Size] [nvarchar](5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[SizeUnitMeasureCode] [nchar](3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[WeightUnitMeasureCode] [nchar](3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Weight] [decimal](8, 2) NULL,
	[DaysToManufacture] [int] NOT NULL,
	[ProductLine] [nchar](2) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Class] [nchar](2) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Style] [nchar](2) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[ProductSubcategoryID] [int] NULL,
	[ProductModelID] [int] NULL,
	[SellStartDate] [datetime] NOT NULL,
	[SellEndDate] [datetime] NULL,
	[DiscontinuedDate] [datetime] NULL,
	[rowguid] [uniqueidentifier] ROWGUIDCOL  NOT NULL,
	[ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_Product_ProductID] PRIMARY KEY CLUSTERED 
(
	[ProductID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

ALTER TABLE [Production].[Product]  WITH CHECK ADD  CONSTRAINT [FK_Product_ProductModel_ProductModelID] FOREIGN KEY([ProductModelID])
REFERENCES [ProductModel] ([ProductModelID])
ALTER TABLE [Production].[Product] CHECK CONSTRAINT [FK_Product_ProductModel_ProductModelID]
ALTER TABLE [Production].[Product]  WITH CHECK ADD  CONSTRAINT [FK_Product_ProductSubcategory_ProductSubcategoryID] FOREIGN KEY([ProductSubcategoryID])
REFERENCES [ProductSubcategory] ([ProductSubcategoryID])
ALTER TABLE [Production].[Product] CHECK CONSTRAINT [FK_Product_ProductSubcategory_ProductSubcategoryID]
ALTER TABLE [Production].[Product]  WITH CHECK ADD  CONSTRAINT [FK_Product_UnitMeasure_SizeUnitMeasureCode] FOREIGN KEY([SizeUnitMeasureCode])
REFERENCES [UnitMeasure] ([UnitMeasureCode])
ALTER TABLE [Production].[Product] CHECK CONSTRAINT [FK_Product_UnitMeasure_SizeUnitMeasureCode]
ALTER TABLE [Production].[Product]  WITH CHECK ADD  CONSTRAINT [FK_Product_UnitMeasure_WeightUnitMeasureCode] FOREIGN KEY([WeightUnitMeasureCode])
REFERENCES [UnitMeasure] ([UnitMeasureCode])
ALTER TABLE [Production].[Product] CHECK CONSTRAINT [FK_Product_UnitMeasure_WeightUnitMeasureCode]
ALTER TABLE [Production].[Product]  WITH CHECK ADD  CONSTRAINT [CK_Product_Class] CHECK  ((upper([Class])='H' OR upper([Class])='M' OR upper([Class])='L' OR [Class] IS NULL))
ALTER TABLE [Production].[Product] CHECK CONSTRAINT [CK_Product_Class]
ALTER TABLE [Production].[Product]  WITH CHECK ADD  CONSTRAINT [CK_Product_DaysToManufacture] CHECK  (([DaysToManufacture]>=(0)))
ALTER TABLE [Production].[Product] CHECK CONSTRAINT [CK_Product_DaysToManufacture]
ALTER TABLE [Production].[Product]  WITH CHECK ADD  CONSTRAINT [CK_Product_ListPrice] CHECK  (([ListPrice]>=(0.00)))
ALTER TABLE [Production].[Product] CHECK CONSTRAINT [CK_Product_ListPrice]
ALTER TABLE [Production].[Product]  WITH CHECK ADD  CONSTRAINT [CK_Product_ProductLine] CHECK  ((upper([ProductLine])='R' OR upper([ProductLine])='M' OR upper([ProductLine])='T' OR upper([ProductLine])='S' OR [ProductLine] IS NULL))
ALTER TABLE [Production].[Product] CHECK CONSTRAINT [CK_Product_ProductLine]
ALTER TABLE [Production].[Product]  WITH CHECK ADD  CONSTRAINT [CK_Product_ReorderPoint] CHECK  (([ReorderPoint]>(0)))
ALTER TABLE [Production].[Product] CHECK CONSTRAINT [CK_Product_ReorderPoint]
ALTER TABLE [Production].[Product]  WITH CHECK ADD  CONSTRAINT [CK_Product_SafetyStockLevel] CHECK  (([SafetyStockLevel]>(0)))
ALTER TABLE [Production].[Product] CHECK CONSTRAINT [CK_Product_SafetyStockLevel]
ALTER TABLE [Production].[Product]  WITH CHECK ADD  CONSTRAINT [CK_Product_SellEndDate] CHECK  (([SellEndDate]>=[SellStartDate] OR [SellEndDate] IS NULL))
ALTER TABLE [Production].[Product] CHECK CONSTRAINT [CK_Product_SellEndDate]
ALTER TABLE [Production].[Product]  WITH CHECK ADD  CONSTRAINT [CK_Product_StandardCost] CHECK  (([StandardCost]>=(0.00)))
ALTER TABLE [Production].[Product] CHECK CONSTRAINT [CK_Product_StandardCost]
ALTER TABLE [Production].[Product]  WITH CHECK ADD  CONSTRAINT [CK_Product_Style] CHECK  ((upper([Style])='U' OR upper([Style])='M' OR upper([Style])='W' OR [Style] IS NULL))
ALTER TABLE [Production].[Product] CHECK CONSTRAINT [CK_Product_Style]
ALTER TABLE [Production].[Product]  WITH CHECK ADD  CONSTRAINT [CK_Product_Weight] CHECK  (([Weight]>(0.00)))
ALTER TABLE [Production].[Product] CHECK CONSTRAINT [CK_Product_Weight]
ALTER TABLE [Production].[Product] ADD  CONSTRAINT [DF_Product_MakeFlag]  DEFAULT ((1)) FOR [MakeFlag]
ALTER TABLE [Production].[Product] ADD  CONSTRAINT [DF_Product_FinishedGoodsFlag]  DEFAULT ((1)) FOR [FinishedGoodsFlag]
ALTER TABLE [Production].[Product] ADD  CONSTRAINT [DF_Product_rowguid]  DEFAULT (newid()) FOR [rowguid]
ALTER TABLE [Production].[Product] ADD  CONSTRAINT [DF_Product_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]
See Also

Related Objects

Production Schema
AdventureWorks Database

 

 


© 2012 All Rights Reserved.

Send comments on this topic.