Jump to content


Photo

Databse design question....


  • Please log in to reply
1 reply to this topic

#1 jwwceo

jwwceo
  • Members
  • PipPipPip
  • Advanced Member
  • 212 posts

Posted 27 August 2006 - 12:31 AM

Hello,

I am designing a database, my first one, for a t-shirt website. I have tables for the individual t-shirts, as well as a linked table for all the colors the shirts come in. They share a "color_id" field that is in both tables.

My question is: what do I do if some of the shirts come in more than one color?  How can I design a databse that allows for shirts to have multiple options from the same table???

Any help would be awesome...

James

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 28 August 2006 - 10:10 PM

You need 3 tables -- shirts, colours, and shirt_colours.  The latter is simply a list of pairings -- you can have as many combinations as you wish.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users