AdventureWorks
Production.ProductListPriceHistory Table
Description
Changes in the list price of a product over time.
Properties
Creation Date08/01/2010 08:40
File GroupPRIMARY
Text File Group
System Object
Published for Replication
Rows395
Data Space Used24.00 KB
Index Space Used16.00 KB
Columns
 Column NameDescriptionDatatypeLengthAllow NullsDefaultFormula
Primary Key ProductIDProduct identification number. Foreign key to Product.ProductIDint4   
Primary Key StartDateList price start date.datetime4   
 EndDateList price end datedatetime4  
 ListPriceProduct list price.money8   
 ModifiedDateDate and time the record was last updated.datetime4 
(getdate())
 
Indexes
IndexDescriptionPrimaryUnique
PK_ProductListPriceHistory_ProductID_StartDatePrimary key (clustered) constraint
Check Constraints
NameDescriptionExpression
CK_ProductListPriceHistory_EndDateCheck constraint [EndDate] >= [StartDate] OR [EndDate] IS NULL
([EndDate]>=[StartDate] OR [EndDate] IS NULL)
CK_ProductListPriceHistory_ListPriceCheck constraint [ListPrice] > (0.00)
([ListPrice]>(0.00))
Relationships
RelationshipDescription
FK_ProductListPriceHistory_Product_ProductIDForeign key constraint referencing Product.ProductID.
Objects that depend on Production.ProductListPriceHistory
 Database ObjectObject TypeDescriptionDep Level
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
Objects that Production.ProductListPriceHistory depends on
 Database ObjectObject TypeDescriptionDep Level
dbo.Flag datatypedbo.FlagUser Defined Data Type 2
dbo.Name datatypedbo.NameUser Defined Data Type 2
Production.Product tableProduction.ProductTableProducts sold or used in the manfacturing of sold products.1
Production.ProductCategory tableProduction.ProductCategoryTableHigh-level product categorization.3
Production.ProductModel tableProduction.ProductModelTableProduct model classification.2
Production.ProductSubcategory tableProduction.ProductSubcategoryTableProduct subcategories. See ProductCategory table.2
Production.UnitMeasure tableProduction.UnitMeasureTableUnit of measure lookup table.2
SQL
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
CREATE TABLE [Production].[ProductListPriceHistory](
	[ProductID] [int] NOT NULL,
	[StartDate] [datetime] NOT NULL,
	[EndDate] [datetime] NULL,
	[ListPrice] [money] NOT NULL,
	[ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_ProductListPriceHistory_ProductID_StartDate] PRIMARY KEY CLUSTERED 
(
	[ProductID] ASC,
	[StartDate] 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].[ProductListPriceHistory]  WITH CHECK ADD  CONSTRAINT [FK_ProductListPriceHistory_Product_ProductID] FOREIGN KEY([ProductID])
REFERENCES [Product] ([ProductID])
ALTER TABLE [Production].[ProductListPriceHistory] CHECK CONSTRAINT [FK_ProductListPriceHistory_Product_ProductID]
ALTER TABLE [Production].[ProductListPriceHistory]  WITH CHECK ADD  CONSTRAINT [CK_ProductListPriceHistory_EndDate] CHECK  (([EndDate]>=[StartDate] OR [EndDate] IS NULL))
ALTER TABLE [Production].[ProductListPriceHistory] CHECK CONSTRAINT [CK_ProductListPriceHistory_EndDate]
ALTER TABLE [Production].[ProductListPriceHistory]  WITH CHECK ADD  CONSTRAINT [CK_ProductListPriceHistory_ListPrice] CHECK  (([ListPrice]>(0.00)))
ALTER TABLE [Production].[ProductListPriceHistory] CHECK CONSTRAINT [CK_ProductListPriceHistory_ListPrice]
ALTER TABLE [Production].[ProductListPriceHistory] ADD  CONSTRAINT [DF_ProductListPriceHistory_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]
See Also

Related Objects

Production Schema
AdventureWorks Database

 

 


© 2012 All Rights Reserved.

Send comments on this topic.