Database reference - AdventureWorks2008

AdventureWorks2008 -  tables -  [Production].[ProductListPriceHistory]

Description

Changes in the list price of a product over time. 

Table properties

namevalue
name[Production].[ProductListPriceHistory]
createdMar 19 2009 9:09PM
modifiedMar 19 2009 9:10PM 
ansi nullson 
quoted identifieron 
row count395
Size of data24 kb
Size of indexes16 kb
Maximum size of a single row36 bytes

Columns

columndatatypelengthbytesdefaultnullsPKFKUQcomputedcomment
ProductIDint104 no  composite PK  Product.ProductID      no  Product identification number. Foreign key to Product.ProductID 
StartDatedatetime238 no  composite PK    no  List price start date. 
EndDatedatetime238 yes      no  List price end date 
ListPricemoney198 no      no  Product list price. 
ModifiedDatedatetime238(getdate())no      no  Date and time the record was last updated. 

Indexes

namedescriptioncolumncomment
PK_ProductListPriceHistory_ProductID_StartDateclustered, unique, primary key located on PRIMARYProductID, StartDateClustered index created by a primary key constraint. 

References

name
Product

Foreign key graph

ProductProductListPriceHistory

Foreign keys

namecolumnsforeign columnstypecomment
FK_ProductListPriceHistory_Product_ProductIDProductIDProduct.ProductID   Foreign key constraint referencing Product.ProductID. 

Check constraints

namecolumncomment
CK_ProductListPriceHistory_EndDateStartDate  EndDate    Check constraint [EndDate] >= [StartDate] OR [EndDate] IS NULL 
CK_ProductListPriceHistory_ListPriceListPrice    Check constraint [ListPrice] > (0.00) 

Defaults

default namecolumncomment
DF_ProductListPriceHistory_ModifiedDateModifiedDateDefault constraint value of GETDATE() 

Dependency graph

DF_ProductListPriceHistory_ModifiedDate...ProductListPriceHistoryCK_ProductListPriceHistory_EndDateCK_ProductListPriceHistory_ListPrice...ufnGetProductDealerPriceufnGetProductListPricePK_ProductListPriceHistory_ProductID_StartDate...

Objects that depend on [Production].[ProductListPriceHistory]

nameobject typedatabaseserverlevel
ufnGetProductDealerPricefunctionAdventureWorks2008SPRING\KATMAI1
ufnGetProductListPricefunctionAdventureWorks2008SPRING\KATMAI1

Sample rows

ProductIDStartDateEndDateListPriceModifiedDate
707  7/1/2001 12:00:00 AM  6/30/2002 12:00:00 AM  33.6442  6/30/2002 12:00:00 AM 
707  7/1/2002 12:00:00 AM  6/30/2003 12:00:00 AM  33.6442  6/30/2003 12:00:00 AM 
707  7/1/2003 12:00:00 AM  NULL  34.9900  6/10/2003 12:00:00 AM 
708  7/1/2001 12:00:00 AM  6/30/2002 12:00:00 AM  33.6442  6/30/2002 12:00:00 AM 
708  7/1/2002 12:00:00 AM  6/30/2003 12:00:00 AM  33.6442  6/30/2003 12:00:00 AM 
708  7/1/2003 12:00:00 AM  NULL  34.9900  6/10/2003 12:00:00 AM 
709  7/1/2001 12:00:00 AM  6/30/2002 12:00:00 AM  9.5000  6/30/2002 12:00:00 AM 
710  7/1/2001 12:00:00 AM  6/30/2002 12:00:00 AM  9.5000  6/30/2002 12:00:00 AM 
711  7/1/2001 12:00:00 AM  6/30/2002 12:00:00 AM  33.6442  6/30/2002 12:00:00 AM 
711  7/1/2002 12:00:00 AM  6/30/2003 12:00:00 AM  33.6442  6/30/2003 12:00:00 AM 

Code

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 [Production].[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]



Documentation generated by SqlSpec