AdventureWorks
Sales.ShoppingCartItem Table
Description
Contains online customer orders until the order is submitted or cancelled.
Properties
Creation Date08/01/2010 08:40
File GroupPRIMARY
Text File Group
System Object
Published for Replication
Rows3
Data Space Used8.00 KB
Index Space Used24.00 KB
Columns
 Column NameDescriptionDatatypeLengthAllow NullsDefaultFormula
Primary Key ShoppingCartItemIDPrimary key for ShoppingCartItem records.int4   
 ShoppingCartIDShopping cart identification number.nvarchar50   
 QuantityProduct quantity ordered.int4 
((1))
 
 ProductIDProduct ordered. Foreign key to Product.ProductID.int4   
 DateCreatedDate the time the record was created.datetime4 
(getdate())
 
 ModifiedDateDate and time the record was last updated.datetime4 
(getdate())
 
Indexes
IndexDescriptionPrimaryUnique
IX_ShoppingCartItem_ShoppingCartID_ProductIDNonclustered index.  
PK_ShoppingCartItem_ShoppingCartItemIDPrimary key (clustered) constraint
Check Constraints
NameDescriptionExpression
CK_ShoppingCartItem_QuantityCheck constraint [Quantity] >= (1)
([Quantity]>=(1))
Relationships
RelationshipDescription
FK_ShoppingCartItem_Product_ProductIDForeign key constraint referencing Product.ProductID.
Objects that Sales.ShoppingCartItem 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 [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,
	[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 [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]
See Also

Related Objects

Sales Schema
AdventureWorks Database

 

 


© 2012 All Rights Reserved.

Send comments on this topic.