[thelist] database schema for shopping transaction

Ken Schaefer Ken at adOpenStatic.com
Thu Nov 3 17:00:19 CST 2005


This stuff is covered by ER (Entity-Relationship modeling). There are plenty
of resources on the 'net and they would cover the steps involved in
generating a schema from your requirements/environment.

In terms of your end schema, things like "can a user have multiple carts, or
only a single cart" would determine the final make-up. Now, why would a user
have multiple carts? Perhaps you deal with businesses, and businesses have
employees that use the service, and a PA may need to order stuff on behalf of
a number of individuals.

So you have an entity called "Carts", which would be related to users. Each
cart could contain multiple items, and their corresponding quantities.

The simplest would be something like:
Table: Carts
CartID (PK)
UserID (FK)
OtherFieldsRelatedtoCarts (e.g. creation/expiry dates)

Table: CartsItems
CartID (composite PK, FK)
ItemID (composite PK, FK)
Quantity

Cheers
Ken


-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Anthony Ettinger
Subject: [thelist] database schema for shopping transaction

Anyone have any good pointers on this?

The idea is to have an online shopping cart where the
customer can place multiple items (and quantities). 



More information about the thelist mailing list