SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Modeling A Food Recipes Database


Modeling A Food Recipes Database

Author
Message
robertlewis2001
robertlewis2001
SSC-Enthusiastic
SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)

Group: General Forum Members
Points: 123 Visits: 52
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.
Bipsy
Bipsy
SSC Eights!
SSC Eights! (923 reputation)SSC Eights! (923 reputation)SSC Eights! (923 reputation)SSC Eights! (923 reputation)SSC Eights! (923 reputation)SSC Eights! (923 reputation)SSC Eights! (923 reputation)SSC Eights! (923 reputation)

Group: General Forum Members
Points: 923 Visits: 446
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.
robmullins
robmullins
SSC Rookie
SSC Rookie (41 reputation)SSC Rookie (41 reputation)SSC Rookie (41 reputation)SSC Rookie (41 reputation)SSC Rookie (41 reputation)SSC Rookie (41 reputation)SSC Rookie (41 reputation)SSC Rookie (41 reputation)

Group: General Forum Members
Points: 41 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.
robertlewis2001
robertlewis2001
SSC-Enthusiastic
SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)SSC-Enthusiastic (123 reputation)

Group: General Forum Members
Points: 123 Visits: 52
That does help and thank you very much.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search