Database design for storing food recipes

后端 未结 3 371
傲寒
傲寒 2020-12-25 13:44

I want to make a database of recipes that I like, but I\'m having trouble designing it. I want to have at least two tables:

  1. Recipe table (Has description, ingr
3条回答
  •  误落风尘
    2020-12-25 14:19

    Does one recipe have many ingredients or many recipe's have many ingredients

    I'd expect it will be the latter to allow you to find recipe's by ingredient.

    So you will need an intermediate table to break the many to many relationship into two one to many relationships.

    Recipe(RecipeID, etc...) 
    Ingredients(IngredientID, etc....)
    RecipeIngredients(RecipeID, IngredientID, etc..)
    

    Then in RecipeIngredients I would put information such as quantities of that ingredient for that recipe.

提交回复
热议问题