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 > Database Server Software > MySQL > product table structure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-04-05, 13:48
jfoote1999 jfoote1999 is offline
Registered User
 
Join Date: Jan 2005
Posts: 1
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
Reply With Quote
  #2 (permalink)  
Old 01-04-05, 23:25
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
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
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
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