Up to now when creating a store I've been selling items such as CDs which
would have band, title, check to see the amount still in stock, etc...

Now I'm creating a store front for a sweater manufacturer.

There are a variety of different sweaters. No problem :-)
There are a variety of different color. Again, no problem :-)

Sweater A comes in colors red and white.
Sweater B comes in colors white and blue.

Problem: how to set up the db to handle this.

TABLE ITEMS (table of all the items to be displayed/sold)

itemID (PK)

TABLE COLORS (table of all the potential colors - used to populate
itemColors)

colorsID (PK)
color

TABLE ITEMCOLORS (table listing all colors for a particular item)

itemColorsID (PK)
itemID
colorsID

To get the colors for Sweater A do a

SELECT *
FROM itemColors
WHERE itemID = whatever

That was the first idea. What about a field in ITEMS called itemColors so
that the record for Sweater A would look like

itemID | 1001
itemName | Sweater A
itemColor | red, white

thx

Gibert Midonnet
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to