Hello people.
I have been struggling for some time now with drawing up a relationship diagram module for my scenario.
I have three tables as of now.
1) Recipes
2) Ingredients
3) RecipesIngredients
Recipes --(one to many) ---|> RecipesIngredients <|-----(many to one) --- Ingredients
Some of the Recipes
Some of the Ingredients
What I can do is brake EVERY Recipe down to their basic Ingredients like
RecipesIngredients
For example to make a Platter one would need Lettuce, Tomato, Meat and Spices.
The problem.
a Salads ingredients are Lettuce and Tomato and that of Sausages are Meat and Spices.
So as a matter of fact a Platter is made up of both a Salad and Sausages which is both in my Recipes table.
The questions.
Should I brake every Recipe down to their bare Ingredients
OR
Is there a way to make the RecipesIngredients reflect more than one Recipes ID, take into consideration not all Recipes uses Recipes that are allready in the Recipes table.
Achievement.
What I am trying to achieve is when the user select a Platter.
They only see the Salad and Sausage being it an image or just the name on a labe BUT when they select the Salad or the Sausage they will see their Ingredients.
I have been struggling for some time now with drawing up a relationship diagram module for my scenario.
I have three tables as of now.
1) Recipes
2) Ingredients
3) RecipesIngredients
Recipes --(one to many) ---|> RecipesIngredients <|-----(many to one) --- Ingredients
Some of the Recipes
IDR | Name |
1 | Platter (pre defined ingredients) |
2 | Salad (pre defined ingredients) |
3 | Sausage |
4 | Chips |
Some of the Ingredients
IDI | Name |
1 | Lettuce |
2 | Potatoes |
3 | Tomato |
4 | Meat |
5 | Spices |
What I can do is brake EVERY Recipe down to their basic Ingredients like
RecipesIngredients
ID | IDR | IDI | Quantity |
1 | 1 | 1 | 2 |
2 | 1 | 2 | 1 |
3 | 1 | 3 | 1 |
4 | 1 | 5 | 1 |
For example to make a Platter one would need Lettuce, Tomato, Meat and Spices.
The problem.
a Salads ingredients are Lettuce and Tomato and that of Sausages are Meat and Spices.
So as a matter of fact a Platter is made up of both a Salad and Sausages which is both in my Recipes table.
The questions.
Should I brake every Recipe down to their bare Ingredients
OR
Is there a way to make the RecipesIngredients reflect more than one Recipes ID, take into consideration not all Recipes uses Recipes that are allready in the Recipes table.
Achievement.
What I am trying to achieve is when the user select a Platter.
They only see the Salad and Sausage being it an image or just the name on a labe BUT when they select the Salad or the Sausage they will see their Ingredients.