Description
Contains online customer orders until the order is submitted or cancelled.
Table properties
| name | value |
|---|
| name | [Sales].[ShoppingCartItem] |
| created | Mar 19 2009 9:09PM |
| modified | Mar 19 2009 9:10PM
|
| ansi nulls | on
|
| quoted identifier | on
|
| row count | 3 |
| Size of data | 8 kb |
| Size of indexes | 24 kb |
| Maximum size of a single row | 228 bytes |
Columns
| column | datatype | length | bytes | default | nulls | PK | FK | UQ | computed | comment |
|---|
| ShoppingCartItemID | int identity(1,1) | 10 | 4 | | no
| yes
| |
| no
| Primary key for ShoppingCartItem records.
|
| ShoppingCartID | nvarchar(50) | 50 | 200 | | no
|
| |
| no
| Shopping cart identification number.
|
| Quantity | int | 10 | 4 | ((1)) | no
|
| |
| no
| Product quantity ordered.
|
| ProductID | int | 10 | 4 | | no
|
| Product.ProductID
|
| no
| Product ordered. Foreign key to Product.ProductID.
|
| DateCreated | datetime | 23 | 8 | (getdate()) | no
|
| |
| no
| Date the time the record was created.
|
| ModifiedDate | datetime | 23 | 8 | (getdate()) | no
|
| |
| no
| Date and time the record was last updated.
|
Indexes
References
Foreign key graph
Foreign keys
| name | columns | foreign columns | type | comment |
|---|
| FK_ShoppingCartItem_Product_ProductID | ProductID | Product.ProductID |
| Foreign key constraint referencing Product.ProductID.
|
Check constraints
Defaults
Dependency graph
Sample rows
| ShoppingCartItemID | ShoppingCartID | Quantity | ProductID | DateCreated | ModifiedDate |
|---|
| 2
| 14951
| 3
| 862
| 12/11/2003 5:54:07 PM
| 12/11/2003 5:54:07 PM
|
| 4
| 20621
| 4
| 881
| 12/11/2003 5:54:07 PM
| 12/11/2003 5:54:07 PM
|
| 5
| 20621
| 7
| 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]