(And thanks btw) The problem I have is how the uses table describes the relationship.
Basically the uses table, to work the way I need it to, would look something like this:
Uses(recipe_id, ingredient_id_01, ingredient_id_02) etc. -- because each recipe may use > one ingredient from the ingredient table. So the output would eventually need to look like this:
You searched for all recipes with tuna (ingredient_id=tuna):
Recipe: Tuna Casserole (recipe_id="tuna casserole")
Recipe: Your mother's gross tuna recipe (and so on)
Recipe: The stuff you feed your cat
etc.
So, the logic is, click on an ingredient from the ingredient table. Query will locate each recipe_id that includes the chosen ingredient_id.
Hmmm. Did I just answer my question? If it's set up the way I described, based on your suggestion - would there be any need to establish relationships? Or would it work like that?
In particular I'm wondering about what to name each field in the uses table - I assume I need distinct names for each field in the table - like ingredient_id_01, ingredient_id_02 etc. -- or not? Sorry for the newbiness. Haven't got the zen of it yet.
Quote:
|
Originally Posted by Pat Phelan
I'd do this a wee bit differently.
My ingredient table would include the ingredientId and its name.
My reciepe table would match yours.
My "uses" table would describe the relationship between the receipe and the ingredient. It would include the receipeID, the ingredientId, and the measurement (how much of this ingredient does this receipe need).
See if looking at the problem that way helps!
-PatP
|