Database reference - AdventureWorks

AdventureWorks -  tables -  [Production].[ProductReview]

Description

Customer reviews of products they have purchased. 

Table properties

namevalue
name[Production].[ProductReview]
createdMar 19 2009 9:08PM
modifiedMar 19 2009 9:08PM 
ansi nullson 
quoted identifieron 
row count4
Size of data16 kb
Size of indexes56 kb
Maximum size of a single row15,828 bytes

Columns

columndatatypelengthbytesdefaultnullsPKFKUQcomputedcomment
ProductReviewIDint identity(1,1)104 no  yes    no  Primary key for ProductReview records. 
ProductIDint104 no    Product.ProductID      no  Product identification number. Foreign key to Product.ProductID. 
ReviewerNameName50200 no      no  Name of the reviewer. 
ReviewDatedatetime238(getdate())no      no  Date review was submitted. 
EmailAddressnvarchar(50)50200 no      no  Reviewer's e-mail address. 
Ratingint104 no      no  Product rating given by the reviewer. Scale is 1 to 5 with 5 as the highest rating. 
Commentsnvarchar(3850)385015400 yes      no  Reviewer's comments 
ModifiedDatedatetime238(getdate())no      no  Date and time the record was last updated. 

Indexes

namedescriptioncolumncomment
IX_ProductReview_ProductID_Namenonclustered located on PRIMARYProductID, ReviewerName, CommentsNonclustered index. 
PK_ProductReview_ProductReviewIDclustered, unique, primary key located on PRIMARYProductReviewIDClustered index created by a primary key constraint. 

References

name
Product

Foreign key graph

ProductProductReview

Foreign keys

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

Check constraints

namecolumncomment
CK_ProductReview_RatingRating    Check constraint [Rating] BETWEEN (1) AND (5) 

Defaults

default namecolumncomment
DF_ProductReview_ReviewDateReviewDateDefault constraint value of GETDATE() 
DF_ProductReview_ModifiedDateModifiedDateDefault constraint value of GETDATE() 

Dependency graph

DF_ProductReview_ModifiedDateDF_ProductReview_ReviewDateNameProductReviewCK_ProductReview_RatingIX_ProductReview_ProductID_Name...PK_ProductReview_ProductReviewID...

Objects that [Production].[ProductReview] depends on

nameobject typelevel
Nametype1

Sample rows

ProductReviewIDProductIDReviewerNameReviewDateEmailAddressRatingCommentsModifiedDate
709  John Smith  10/20/2003 12:00:00 AM  john@fourthcoffee.com  I can't believe I'm singing the praises of a pair of socks, but I just came back from a grueling 3-...  10/20/2003 12:00:00 AM 
937  David  12/15/2003 12:00:00 AM  david@graphicdesigninstitute.com  A little on the heavy side, but overall the entry/exit is easy in all conditions. I've used these pe...  12/15/2003 12:00:00 AM 
937  Jill  12/17/2003 12:00:00 AM  jill@margiestravel.com  Maybe it's just because I'm new to mountain biking, but I had a terrible time getting use to these ...  12/17/2003 12:00:00 AM 
798  Laura Norman  12/17/2003 12:00:00 AM  laura@treyresearch.net  The Road-550-W from Adventure Works Cycles is everything it's advertised to be. Finally, a quality b...  12/17/2003 12:00:00 AM 

Code

CREATE TABLE [Production].[ProductReview](
    [ProductReviewID] [int] IDENTITY(1,1) NOT NULL,
    [ProductID] [int] NOT NULL,
    [ReviewerName] [dbo].[Name] NOT NULL,
    [ReviewDate] [datetime] NOT NULL,
    [EmailAddress] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    [Rating] [int] NOT NULL,
    [Comments] [nvarchar](3850) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [ProductReviewID] [int] IDENTITY(1,1) NOT NULL,
    [ReviewDate] [datetime] NOT NULL,
    [EmailAddress] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    [Rating] [int] NOT NULL,
    [ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_ProductReview_ProductReviewID] PRIMARY KEY CLUSTERED 
(
    [ProductReviewID] 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].[ProductReview]  WITH CHECK ADD  CONSTRAINT [FK_ProductReview_Product_ProductID] FOREIGN KEY([ProductID])
REFERENCES [Production].[Product] ([ProductID])
ALTER TABLE [Production].[ProductReview] CHECK CONSTRAINT [FK_ProductReview_Product_ProductID]
ALTER TABLE [Production].[ProductReview]  WITH CHECK ADD  CONSTRAINT [CK_ProductReview_Rating] CHECK  (([Rating]>=(1) AND [Rating]<=(5)))
ALTER TABLE [Production].[ProductReview] CHECK CONSTRAINT [CK_ProductReview_Rating]
ALTER TABLE [Production].[ProductReview] ADD  CONSTRAINT [DF_ProductReview_ReviewDate]  DEFAULT (getdate()) FOR [ReviewDate]
ALTER TABLE [Production].[ProductReview] ADD  CONSTRAINT [DF_ProductReview_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]

Powered by Yoyodyne © 1971