Results 1 to 3 of 3

Thread: Database Design

  1. #1
    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

  2. #2
    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
    Last edited by r123456; 12-05-03 at 10:39.
    Bessie Braddock: Winston, you are drunk!
    Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

  3. #3
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •