Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005
    Posts
    1

    Unanswered: product table structure

    Hi,

    I have a question regarding structure of my products table. I am trying to develop a table for various t-shirts, sweatshirts, etc. I currently have productid, price, picture, category, description, etc. My question regards how to handle multiple colors. I don't really want to repeat all the data in the rows each time i have another color becuase that causes conflicts with the productid's and my sort options.
    I thought about a colorid linking to another table but i dont know if that would solve the problem or just over-complicate it.

    Does anyone have any suggestions?

    Thanks,
    Jesse Foote

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    that's a good solution

    the relationship is many-to-many between product and colour, so you need a separate colour table, and then a relationship table to record the keys of product and colour which define which colours the products are available in

    over-complicated is when you try to do stuff like place a list of colour codes into a single column in the product table -- that's asking for a world of hurt

    i would personally stay away from ENUM datatype as well
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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