Preface: I have for the most part never worked with databases, and am new. So my terminology may be incorrect at times.

I was wondering what the correct procedure would be for creating a database that has objects with multiple objects contained in them.

For a practical example, I was thinking if I were to make a database with separate meals, and also have the ingredients within the meals, how should I go about doing this? I was thinking it might look like this:

Meals  | Ingredient  | ~
Chili  | Ground Beef | ~
Chili  | Beans       | ~
Chili  | Corn        | ~
Burger | Ground Beef | ~
Burger | Tomato      | ~
Burger | Lettuce     | ~
Burger | Bun         | ~

(the tilde represents extra columns, maybe calories, unit price, etc)

I was thinking this might be good, but I wouldn't be to sure how to group the meals. Would I have to make some query that looks through the meals column, finds similar names, then groups them together?

Not sure if there would be any better way of storing this type of information?


1 Answer 1


Meals and Ingredients are two separate entities joined like M:N. The most common storing structure consists from 3 tables - one table per each entity (2 tables) and join table which is referenced to first two tables. - Akina

You might find the following Q & A helpful: When to add another lookup table for the same field

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.