Wednesday, March 17, 2010

MySQL query + table/field setup?

I must ask


How do large #'s of items fit inside MySQL table/fields with multiple categories


Im using PHP+MySQL, Im unable to design with this skill





example using flowers


many flowers in many different occassions %26amp; categories


fields : data


flower item: 12 roses


category: roses, 1 dozen, red, yellow, pink, white


occassion: birthday, anniversary, surprise, easter


price: 29.99


shipping: same day


description: classic romance, one dozen red roses is always a good choice


itemID: RR345-2


color: red, yellow, pink, white





I would like to have seperate field/subfield for all data, that is the problem I cant get around


Do I place all data in same field comma delimited %26amp; run the output of my query through many filters to arrange %26amp; format

MySQL query + table/field setup?
Normally what you would do is set up multiple tables to handle the different categories. You would have one table that contained the order information. Using the colors as an example, in that order table you would store the number 1 (or you could use red) in the color field. Then you would have a table named colors that would have an Id field with the number 1 and a description of red. Then when you are doing the query to pull the data, you do a join on the two tables. You set up any field with multiple categories the same way. So in the end, you just end up doing multiple joins on the tables you created.



makeup tips

No comments:

Post a Comment

Blog Archive