Results 1 to 3 of 3

Thread: Database Design

  1. #1
    Join Date
    Dec 2003

    Database Design


    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


  2. #2
    Join Date
    Sep 2003
    The extremely Royal borough of Kensington, London
    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.
    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 -
    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
    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