[thelist] PHP/MSQL question millions or thousands

Joshua Olson joshua at waetech.com
Wed Feb 6 08:24:37 CST 2008


> -----Original Message-----
> From: David Menzel
> Sent: Wednesday, February 06, 2008 9:14 AM
> 
> There are probably people here with better answers than me as 
> im still 
> learning alot, but I would handle this by making a table for all the 
> ingredients, with a key field that links to the unique primary key of 
> the actual recipe. Then you can store some info on each 
> ingredient for 
> each recipe separately, but still pull them all up with one query.

Ok, so here's taking it one step farther:

Make a table containing all unique ingredients.  Then, establish an
associative table that links ingredients to recipes in a many-to-many
relationship.  In this associative table you would put information
pertaining specifically to that ingredient's usage in the recipe such as
quantity or preparation instructions (chopped vs whole pecans, for example).
You could put additional facts about ingredients into the table contianing
the ingredients such as nutritional information, history, acquisition
sources, etc--this information could then be used as reference for any
recipe including that ingredient.

What I'm doing with the above ideas is normalizing the data [0].  It's not
100% normalized, but it's on its way.

Is this over-engineering for this situation? yeah, probably.  Fun to think
about? yeah.

Joshua

[0] http://www.datamodel.org/NormalizationRules.html

<><><><><><><><><><>
Joshua L. Olson
WAE Technologies, Inc.
Augusta, Georgia Web Design
http://www.waetech.com/
Phone: 706.210.0168
Fax: 707.988.0168
Private Enterprise Number: 28752

Portfolio:
http://www.waetech.com/design/portfolio/

Monitor bandwidth usage on IIS6 in real-time:
http://www.waetech.com/services/iisbm/ 



More information about the thelist mailing list