Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Modeling A Food Recipes Database Expand / Collapse
Author
Message
Posted Tuesday, February 8, 2011 9:27 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, November 20, 2013 8:06 AM
Points: 9, Visits: 51
I'm trying to design a "recipe box" database and I'm having trouble getting it right. I have no idea if I'm on the right track or not, but here's what I have.

recipes(recipeID, etc.)
ingredient(ingredientID, etc.)
recipeIngredient(recipeID, ingredientID, amount)
category(categoryID, name)
recipeCategory(recipeID, categoryID, etc.)

So I have a couple of questions.

* How am I doing so far? Is this design okay from what you all know?
* How would I implement the preparation steps? Should I create an additional many-to-many implementation (something like preparation(prepID, etc.) and recipePrep(recipeID, prepID)) or just add the directions in the recipes table? I would like this to be an ordered list in the UI (webpage).

Thank you for your help.
Post #1060800
Posted Tuesday, February 8, 2011 11:26 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, October 22, 2014 8:14 AM
Points: 53, Visits: 412
Follow simple rule for data modelling:-

Identify the attributes(columns in tables) from project SOW.
Identyfing relationships among these attributes.
If you have one-2-one relationship then club all these attributes in single entity called db table.
If we have one to many relationship then use Primary forgien key relationship.
If we have many-2-many relationship then use junction tables.

I hope this would help you.
Post #1060843
Posted Thursday, March 3, 2011 6:57 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, October 5, 2011 7:45 AM
Points: 5, Visits: 24

So I have a couple of questions.

* How am I doing so far? Is this design okay from what you all know?

It looks pretty good. I would suggest using a proprietary product like MS Visio 2010 to model your project however with either ERM or UML. I know it's a bit 'Ivory Tower' but it's good practice to use some kind of visual aid to help model the entire thing. Some people tend to use a 'just go for it' approach and make alterations later, and that is fine if you already kinda know what you are doing.

* How would I implement the preparation steps? Should I create an additional many-to-many implementation (something like preparation(prepID, etc.) and recipePrep(recipeID, prepID)) or just add the directions in the recipes table? I would like this to be an ordered list in the UI (webpage).
You really want to avoid M:N relationships like the plague. They can plague your database with redundancies, and give you out put errors. This can also let to an enourmous amount of work just trying to 'normalize' the dern thing. If you happen to come across a M:N then simply use a 'Bridge Entity' (associative entity) to get you back to a 1:M situation.
As 'Grasshopper' just said, make sure you use 'Foreign Keys' to keep referential integrity between your relations.

Hope that helps.
Post #1072512
Posted Thursday, March 3, 2011 9:06 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, November 20, 2013 8:06 AM
Points: 9, Visits: 51
That does help and thank you very much.
Post #1072625
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse