I have these tables:

First table(Recipe table),





Second table(Ingredients table),





Then a 3rd one for display,





How do i construct another table and its relation to the ingredient table to determine its nutritional value.

Should i add another column for nutrition on my ingredient table? Or create another table for nutrition which holds the ingredient id as FK.



Say i am diabetic so i should avoid recipes with high amounts of sugar. So from ingredients... im confused where to move from there.

  • 1
    Is your question about the subject matter or about the table design? Commented Nov 30, 2014 at 20:36
  • 1
    I don't understand your table design. I cannot understand what is the meaning of recipe.ingredients columnd and the ingredients.quantity column. Can you tell me about meaning of these olumns?
    – miracle173
    Commented Nov 30, 2014 at 23:14
  • I suggest that you name tables and attributes consistently so it will be either Recipe & Ingredient or Recipes & Ingredients. The first option is better. Commented Nov 21, 2015 at 8:30

2 Answers 2


You probably want to have some risk information in your NUTRITION table. Perhaps a text column to describe the risk and a threshold quantity column, which might be optional, to describe what is a safe and an unsafe amount.

The thing you have to decide is whether you want to try to normalize out some other information from your nutrition risk descriptions. For example, do you want to have a MEDICAL_CONDITION table that allows risks to be categorized in terms of what type of person is at risk (e.g. diabetes, nut allergy, lactose intolerance,...)

From a design perspective, we can't answer your question about what is needed. That depends on your business rules and what you want to achieve. We can help with technical design questions based on specific statements of your business rules.

  • Would you care to show me the structure of the tables you mentioned? both nutrition and its relation to medical_condition. I think ive grasped what you are trying to convey, but i find it hard to decide the structure of my table. Im referring to the table columns.
    – John
    Commented Feb 10, 2014 at 0:52

Not 100% sure what you are trying to achieve, but few notes:

In your proposed Nutrition table the class schema would look like this:

Your version

It would mean "Nutrition utilizes Ingredient" or "Nutrition HAS Ingredient". Which I believe is not what you need.

Link to nutrition table

Instead you need a relation "Ingredient has Nutrition", so that Nutrition is an attribute or a property of Ingredient. If you need reusable nutrition categories, like "Nutrition level A" etc., you may introduce a separate Nutrition table. Then you will have to add NutritionId foreign key to the Ingredient table.

enter image description here

Otherwise it is just enough to add a NutritionValue attribute to the table Ingredient.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.