Looking for a solution to build a database for recipe generation. A number of ingredients are used to create recipe and further a recipe can also contain a recipe plus can also have some ingredients.
For example: recipe R1 needs three products i.e I1, I2, I3.
But recipe R2 needs recipe R1 and in addition to it some other ingredients, maybe I4, I5, I6
So
R1 = I1 + I2 + I3
whereas
R2 = R1 + I4 + I5 + I6
To accomplish this, I have an Ingredient
table like below:
Id name
--------
1 I1
2 I2
3 I3
4 I4
5 I5
6 I6
Now I need maping where I can map Recipe with ingredients like
Recipe
table
Id Name
------------
1 Recipe1
2 Recipe2
Recipe FormulationTable
Id RecipeId IngredientId
-----------------------------
1 1 1
2 1 2
3 1 3
4 2 4
5 2 5
6 2 6
7 2
but here I can not add any ingredient as recipe 2 needs 4,5,6 and recipe 2
How can I map these tables so that I may fetch any kind of information at my dashboard
Like->
- Recipe 1 has three ingredients
- but Recipe 2 has other three ingredients and also it contains receipe1