I have two tables: ingredient and recipe
recipe table
-----------------------
|recipe_id |name |
-----------------------
|1 |Pasta |
|2 |Pizza |
|3 |Fish |
ingredient table
-------------------------------
|ingredient_id |name |
-------------------------------
|1 |Spaghetti |
|2 |Salmon |
|3 |Tomato sauce|
Then I have a junction table for these two tables.
---------------------------
|id|recipe_id|ingredient_id|
---------------------------
|1 |1 |1 |
|2 |2 |3 |
|3 |3 |2 |
It's not clear for me how I should insert data in the junction table. I mean, do I have to insert the recipe_id
and ingredient_id
manually with a simple INSERT? Or do I have to use the relations with the other two tables in some way?