I have a database that I've called "food" and I'm a bit stumped on how to store the ingredients for a recipe. Should I create a separate table for the ingredients or just have the ingredients insert into the Recipe table as a comma-delimited list? Different recipes will not be using the "same ingredients" in that, they won't be sharing a value such as onion. If 10 ten different recipes have onions, then onion will be in the database 10 times (is that smart?).
Food Database Design – Most Efficient Way to Store Ingredients
database-design
Related Question
- Database Design – How to Store List of Unknown Size
- What Is the Next Best Ingredient to Add
- Database Design – Data Model Reference and Schema
- Filter ingredients choices for recipe database by category, or dynamic search
- Postgresql – Best way to model a database structure to store multidimensional variables
- Name for a “lookup” table with values in separate rows
- Designing a database of Recipes
Best Answer
I think ingredients should go in a master table and another table to map ingredient to recipe. The following is the basic idea:
Please note that the script above might have some errors due to syntax.
The advantage of this approach:
Hopefully this would help.