Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database design for storing food recipes

Tags:

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, ingredients, directions, etc...)
  2. Ingredients table (ingredient type, other attributes, etc...)

What would be a way to associate a the two tables together? Would I need a third table that would store the several relationships from a recipe to multiple ingredients?

As you can probably tell, I'm relatively new to this stuff, just trying to figure out the right way to do it on the first try.

Thanks!

like image 267
Cass Avatar asked Jul 12 '10 02:07

Cass


People also ask

How to make a Recipe book in Access?

Recipe FormClick on Access' “Create” tab and then click on the “More Forms” drop-down in the Forms section. Select “Form Wizard” and an input box will pop up. Click on the drop-down box and select “T002 – Recipes.” Now click on the “>>” and all of the fields in our recipes table will be included on our form.


2 Answers

Here is a link to a pretty advanced one:

http://www.databaseanswers.org/data_models/recipes/index.htm

but if you really want to code it yourself I would go with a third relational table.

cheers, Mike

like image 100
Swift Avatar answered Oct 12 '22 01:10

Swift


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.

like image 31
Chris Diver Avatar answered Oct 12 '22 01:10

Chris Diver