If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Database Design

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-05-03, 05:49
sajsal sajsal is offline
Registered User
 
Join Date: Dec 2003
Posts: 2
Database Design

Hello

I'm designing a database for an online shopping cart. I have the requirement such that a product has many sizes and colors. Depending upon these colors and/or sizes site administrator applies special offers on the products. There might be some products which don't have any size or color.
In summary:
Product has zero or many colors
Product has zero or many sizes
Special offer is offered according to the size and/or color

How can I represent this situation in an ERD and then a table structure

Regards
Reply With Quote
  #2 (permalink)  
Old 12-05-03, 09:36
r123456 r123456 is offline
Registered User
 
Join Date: Sep 2003
Location: The extremely Royal borough of Kensington, London
Posts: 778
If size and color form a required combination then,

Product_details(product_id, color, size)
primary key (product_id, color, size)
Special_offers(above3, special_offer) assuming many to many.
OR
add offer_id to product_details as a foreign key, or the primary key of product details to special_offers table, depending on the requirement associated with Special Offers.

Should you be concerned about the use of a surrogate key opposed to "above3", there are many threads that discuss this.

Brief Example - http://www.dbforums.com/t971956.html
__________________
Bessie Braddock: Winston, you are drunk!
Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

Last edited by r123456; 12-05-03 at 09:39.
Reply With Quote
  #3 (permalink)  
Old 12-18-03, 15:33
certus certus is offline
Registered User
 
Join Date: Dec 2003
Location: Canada
Posts: 710
If your able to write a shopping cart, you should not be asking this question. Draw an ERD and ask for suggestions.
__________________
visit: relationary
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On