I agree. I think a join is easier to work with. But ... I guess I didn't ask
the question properly. Which would be processed faster?

A SQL join or having the items in one field.  Except for the shopping cart
area, in which the colors would be placed in a <select> list, they would be
displayed in a comma delimited list. red, white, blue, black, green (etc...)
Actually it's more like ruby, prussian blue, antique white and avocado, but
that's another story.

Anyway. I think I'm going with the tables rather than bunching them up in
one field. Guess I just wanted to bounce the idea around. Thx

Gil Midonnet
  -----Original Message-----
  From: Tony Weeg [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, December 02, 2003 3:46 PM
  To: CF-Talk
  Subject: RE: store dB - question re items

  I think that's a matter of how you feel like looking up the data, string
  sorted is ok, but then what if that changes, you have to change the
string,
  inside the table, but if its columnar and theres an row for each
item/color
  pair I think it would be easier to have a join table that links an item to
  its color choices...

  ...tony

  tony weeg
  senior web applications architect
  navtrak, inc.
  www.navtrak.net
  [EMAIL PROTECTED]
  410.548.2337

  -----Original Message-----
  From: mayo [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, December 02, 2003 3:43 PM
  To: CF-Talk
  Subject: store dB - question re items

  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