Ask Your Question
0

Recipe DB - one to many relationship [closed]

asked 2015-12-31 03:46:03 +0200

wildblue gravatar image

updated 2016-01-01 18:19:33 +0200

Alex Kemp gravatar image

Greetings and than you in advance for your time and assistance. Though not new to databases, am somewhat new (novice?) to Libre base.

This is my issue, I am attempting to create a database of recipes with multiple tables -

Recipe - name, directions with relationship to the tables quantities, measures and ingredients. A one-to-one relationship is easy. However with Base, not sure how to make the relationship to each of the 'sub' tables which each recipe can have multiple entries.

Using Libre Version: 5.0.4.2 Build ID: 1:5.0.4~rc2-0ubuntu1~trusty1 installed on Ubuntu 14.01 LTS

Your assistance in this is greatly appreciated. If I have neglected to include any information, or not answered any pertinent questions please let me know.

~Respect

Kevin

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by wildblue
close date 2017-12-18 00:18:50.692990

1 Answer

Sort by » oldest newest most voted
0

answered 2016-01-01 01:16:56 +0200

frofa gravatar image

updated 2016-01-01 01:29:42 +0200

Basically a recipe is a list of ingredients (with quantities) and some preparation directions. One recipe may have multiple ingredients and one ingredient may be used in multiple recipes, so the relationship between the rows of these 2 tables is many-to-many (or n:n). To accomplish this n:n relationship you will need a third 'junction' table recipe_ingredients to store the IDs of the ingredients against the IDs of each of the recipes. If you only need to store one set of directions per recipe, then you may store this 'directions' text as a column in your recipes table.

See this discussion for a bit more in-depth info, and also this discussion for an example database including a working form (with sub-form) for study.

Some recipe database schemas may be much more complicated because they cater (ha!) for more real world flexibility (see the link in the first reference given above).

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-12-31 03:46:03 +0200

Seen: 274 times

Last updated: Jan 01 '16