Database reference - AdventureWorks2008

AdventureWorks2008 -  tables -  [Sales].[ShoppingCartItem]

Description

Contains online customer orders until the order is submitted or cancelled. 

Table properties

namevalue
name[Sales].[ShoppingCartItem]
createdMar 19 2009 9:09PM
modifiedMar 19 2009 9:10PM 
ansi nullson 
quoted identifieron 
row count3
Size of data8 kb
Size of indexes24 kb
Maximum size of a single row228 bytes

Columns

columndatatypelengthbytesdefaultnullsPKFKUQcomputedcomment
ShoppingCartItemIDint identity(1,1)104 no  yes    no  Primary key for ShoppingCartItem records. 
ShoppingCartIDnvarchar(50)50200 no      no  Shopping cart identification number. 
Quantityint104((1))no      no  Product quantity ordered. 
ProductIDint104 no    Product.ProductID      no  Product ordered. Foreign key to Product.ProductID. 
DateCreateddatetime238(getdate())no      no  Date the time the record was created. 
ModifiedDatedatetime238(getdate())no      no  Date and time the record was last updated. 

Indexes

namedescriptioncolumncomment
IX_ShoppingCartItem_ShoppingCartID_ProductIDnonclustered located on PRIMARYShoppingCartID, ProductIDNonclustered index. 
PK_ShoppingCartItem_ShoppingCartItemIDclustered, unique, primary key located on PRIMARYShoppingCartItemIDClustered index created by a primary key constraint. 

References

name
Product

Foreign key graph

ProductShoppingCartItem

Foreign keys

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

Check constraints

namecolumncomment
CK_ShoppingCartItem_QuantityQuantity    Check constraint [Quantity] >= (1) 

Defaults

default namecolumncomment
DF_ShoppingCartItem_QuantityQuantityDefault constraint value of 1 
DF_ShoppingCartItem_DateCreatedDateCreatedDefault constraint value of GETDATE() 
DF_ShoppingCartItem_ModifiedDateModifiedDateDefault constraint value of GETDATE() 

Dependency graph

DF_ShoppingCartItem_DateCreatedDF_ShoppingCartItem_ModifiedDateDF_ShoppingCartItem_QuantityShoppingCartItemCK_ShoppingCartItem_QuantityIX_ShoppingCartItem_ShoppingCartID_ProductID...PK_ShoppingCartItem_ShoppingCartItemID...

Sample rows

ShoppingCartItemIDShoppingCartIDQuantityProductIDDateCreatedModifiedDate
14951  862  12/11/2003 5:54:07 PM  12/11/2003 5:54:07 PM 
20621  881  12/11/2003 5:54:07 PM  12/11/2003 5:54:07 PM 
20621  874  12/11/2003 5:54:07 PM  12/11/2003 5:54:07 PM 

Code

CREATE TABLE [Sales].[ShoppingCartItem](
    [ShoppingCartItemID] [int] IDENTITY(1,1) NOT NULL,
    [ShoppingCartID] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    [Quantity] [int] NOT NULL,
    [ProductID] [int] NOT NULL,
    [ShoppingCartItemID] [int] IDENTITY(1,1) NOT NULL,
    [Quantity] [int] NOT NULL,
    [DateCreated] [datetime] NOT NULL,
    [ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_ShoppingCartItem_ShoppingCartItemID] PRIMARY KEY CLUSTERED 
(
    [ShoppingCartItemID] 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 [Sales].[ShoppingCartItem]  WITH CHECK ADD  CONSTRAINT [FK_ShoppingCartItem_Product_ProductID] FOREIGN KEY([ProductID])
REFERENCES [Production].[Product] ([ProductID])
ALTER TABLE [Sales].[ShoppingCartItem] CHECK CONSTRAINT [FK_ShoppingCartItem_Product_ProductID]
ALTER TABLE [Sales].[ShoppingCartItem]  WITH CHECK ADD  CONSTRAINT [CK_ShoppingCartItem_Quantity] CHECK  (([Quantity]>=(1)))
ALTER TABLE [Sales].[ShoppingCartItem] CHECK CONSTRAINT [CK_ShoppingCartItem_Quantity]
ALTER TABLE [Sales].[ShoppingCartItem] ADD  CONSTRAINT [DF_ShoppingCartItem_Quantity]  DEFAULT ((1)) FOR [Quantity]
ALTER TABLE [Sales].[ShoppingCartItem] ADD  CONSTRAINT [DF_ShoppingCartItem_DateCreated]  DEFAULT (getdate()) FOR [DateCreated]
ALTER TABLE [Sales].[ShoppingCartItem] ADD  CONSTRAINT [DF_ShoppingCartItem_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]



Documentation generated by SqlSpec