Relating tables - Another novice question

This is a discussion on Relating tables - Another novice question within the MySQL Database forums, part of the Database Forums category; Hello, I am trying to create a data model to represent meals and menus. As part of this, I have ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-20-2007
hugo@laterooms.com
 
Posts: n/a
Default Relating tables - Another novice question

Hello,

I am trying to create a data model to represent meals and menus. As
part of this, I have tables:

Ingredient
Quantity
measurement
Method
Equipment

Recipe
Dish
Meal
Menu

a recipe can contain multiple ingredients (each with quantities and
measurements)
a dish can contain multiple recipies
A meal can contain multiple dishes and so on.

I currently relate the the ingredients and Recipe tables using an
'IngredientList' table which contains fields:

ID
RecipeID
IngredientID
Quantity
Measurement ID

This means that for a given recipe there will be multiple rows in the
'IngredientList' table.

I'm then intending to go on and create 'RecipeList' which will
contain:

ID
Dish ID
RecipeID

and so on.

My question is that it seems like the original 'Dish' table is almost
pointless, as it will contain hardly any information. the fields will
be:

ID
Name
Type

Am I going in the right direction?

Your help is greatly appreciated.

Thanks,

Hugo

Reply With Quote
  #2 (permalink)  
Old 10-20-2007
J.O. Aho
 
Posts: n/a
Default Re: Relating tables - Another novice question

hugo@laterooms.com wrote:

> I currently relate the the ingredients and Recipe tables using an
> 'IngredientList' table which contains fields:
>
> ID
> RecipeID
> IngredientID
> Quantity
> Measurement ID
>
> This means that for a given recipe there will be multiple rows in the
> 'IngredientList' table.


I would skip the ID and make the RecipeID+IngredientID to be the primary key,
this prevents you to have doublets.

> I'm then intending to go on and create 'RecipeList' which will
> contain:
>
> ID
> Dish ID
> RecipeID
>
> and so on.


I would skip the ID and make the DishID+RecipeID to be the primary key, this
prevents you to have doublets.


> My question is that it seems like the original 'Dish' table is almost
> pointless, as it will contain hardly any information. the fields will
> be:
>
> ID
> Name
> Type
>
> Am I going in the right direction?


Say you did include the Name and Type to your 'RecipeList', then you would
have duplicated the data for example:

1 12 "Some Name" "Some Type"
1 14 "Some Name" "Some Type"

In the thought of disk space, it's a steb backward to skip the Dish table.


--

//Aho
Reply With Quote
  #3 (permalink)  
Old 10-20-2007
strawberry
 
Posts: n/a
Default Re: Relating tables - Another novice question

On Oct 20, 10:58 am, h...@laterooms.com wrote:
> Hello,
>
> I am trying to create a data model to represent meals and menus. As
> part of this, I have tables:
>
> Ingredient
> Quantity
> measurement
> Method
> Equipment
>
> Recipe
> Dish
> Meal
> Menu
>
> a recipe can contain multiple ingredients (each with quantities and
> measurements)
> a dish can contain multiple recipies
> A meal can contain multiple dishes and so on.
>
> I currently relate the the ingredients and Recipe tables using an
> 'IngredientList' table which contains fields:
>
> ID
> RecipeID
> IngredientID
> Quantity
> Measurement ID
>
> This means that for a given recipe there will be multiple rows in the
> 'IngredientList' table.
>
> I'm then intending to go on and create 'RecipeList' which will
> contain:
>
> ID
> Dish ID
> RecipeID
>
> and so on.
>
> My question is that it seems like the original 'Dish' table is almost
> pointless, as it will contain hardly any information. the fields will
> be:
>
> ID
> Name
> Type
>
> Am I going in the right direction?
>
> Your help is greatly appreciated.
>
> Thanks,
>
> Hugo


According to your definition, what are 'meals' and 'menus'?

Reply With Quote
  #4 (permalink)  
Old 10-21-2007
strawberry
 
Posts: n/a
Default Re: Relating tables - Another novice question

On 20 Oct, 12:05, strawberry <zac.ca...@gmail.com> wrote:
> On Oct 20, 10:58 am, h...@laterooms.com wrote:
>
>
>
> > Hello,

>
> > I am trying to create a data model to represent meals and menus. As
> > part of this, I have tables:

>
> > Ingredient
> > Quantity
> > measurement
> > Method
> > Equipment

>
> > Recipe
> > Dish
> > Meal
> > Menu

>
> > a recipe can contain multiple ingredients (each with quantities and
> > measurements)
> > a dish can contain multiple recipies
> > A meal can contain multiple dishes and so on.

>
> > I currently relate the the ingredients and Recipe tables using an
> > 'IngredientList' table which contains fields:

>
> > ID
> > RecipeID
> > IngredientID
> > Quantity
> > Measurement ID

>
> > This means that for a given recipe there will be multiple rows in the
> > 'IngredientList' table.

>
> > I'm then intending to go on and create 'RecipeList' which will
> > contain:

>
> > ID
> > Dish ID
> > RecipeID

>
> > and so on.

>
> > My question is that it seems like the original 'Dish' table is almost
> > pointless, as it will contain hardly any information. the fields will
> > be:

>
> > ID
> > Name
> > Type

>
> > Am I going in the right direction?

>
> > Your help is greatly appreciated.

>
> > Thanks,

>
> > Hugo

>
> According to your definition, what are 'meals' and 'menus'?


Hugo wrote in email:

<snip>
Meals are multiple dishes, such as 'Ginger Beef' with
'Creamy potato mash' where both 'ginger beef' and 'creamy potato mash'
are dishes.

Menus are multiple dishes such as starter,main and dessert.
</snip>

OK, well in answer to your question, yes - you're on the right lines.
Dishes and recipes are the same thing so the Dish table is redundant.
If you feel like cheating a little why not visit
http://www.databaseanswers.org/data%...ipes/index.htm which
gives an example of a recipe schema.

Reply With Quote
  #5 (permalink)  
Old 10-22-2007
Jerry Stuckle
 
Posts: n/a
Default Re: Relating tables - Another novice question

strawberry wrote:
> On 20 Oct, 12:05, strawberry <zac.ca...@gmail.com> wrote:
>> On Oct 20, 10:58 am, h...@laterooms.com wrote:
>>
>>
>>
>>> Hello,
>>> I am trying to create a data model to represent meals and menus. As
>>> part of this, I have tables:
>>> Ingredient
>>> Quantity
>>> measurement
>>> Method
>>> Equipment
>>> Recipe
>>> Dish
>>> Meal
>>> Menu
>>> a recipe can contain multiple ingredients (each with quantities and
>>> measurements)
>>> a dish can contain multiple recipies
>>> A meal can contain multiple dishes and so on.
>>> I currently relate the the ingredients and Recipe tables using an
>>> 'IngredientList' table which contains fields:
>>> ID
>>> RecipeID
>>> IngredientID
>>> Quantity
>>> Measurement ID
>>> This means that for a given recipe there will be multiple rows in the
>>> 'IngredientList' table.
>>> I'm then intending to go on and create 'RecipeList' which will
>>> contain:
>>> ID
>>> Dish ID
>>> RecipeID
>>> and so on.
>>> My question is that it seems like the original 'Dish' table is almost
>>> pointless, as it will contain hardly any information. the fields will
>>> be:
>>> ID
>>> Name
>>> Type
>>> Am I going in the right direction?
>>> Your help is greatly appreciated.
>>> Thanks,
>>> Hugo

>> According to your definition, what are 'meals' and 'menus'?

>
> Hugo wrote in email:
>
> <snip>
> Meals are multiple dishes, such as 'Ginger Beef' with
> 'Creamy potato mash' where both 'ginger beef' and 'creamy potato mash'
> are dishes.
>
> Menus are multiple dishes such as starter,main and dessert.
> </snip>
>
> OK, well in answer to your question, yes - you're on the right lines.
> Dishes and recipes are the same thing so the Dish table is redundant.
> If you feel like cheating a little why not visit
> http://www.databaseanswers.org/data%...ipes/index.htm which
> gives an example of a recipe schema.
>
>


I disagree. Dishes and recipes are not necessarily the same.

For instance, one might have Steak Tartar with creamed spinach and au
gratin potatoes. That's three different dishes.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Reply With Quote
  #6 (permalink)  
Old 10-22-2007
Captain Paralytic
 
Posts: n/a
Default Re: Relating tables - Another novice question

On 22 Oct, 00:58, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> strawberry wrote:
> > On 20 Oct, 12:05, strawberry <zac.ca...@gmail.com> wrote:
> >> On Oct 20, 10:58 am, h...@laterooms.com wrote:

>
> >>> Hello,
> >>> I am trying to create a data model to represent meals and menus. As
> >>> part of this, I have tables:
> >>> Ingredient
> >>> Quantity
> >>> measurement
> >>> Method
> >>> Equipment
> >>> Recipe
> >>> Dish
> >>> Meal
> >>> Menu
> >>> a recipe can contain multiple ingredients (each with quantities and
> >>> measurements)
> >>> a dish can contain multiple recipies
> >>> A meal can contain multiple dishes and so on.
> >>> I currently relate the the ingredients and Recipe tables using an
> >>> 'IngredientList' table which contains fields:
> >>> ID
> >>> RecipeID
> >>> IngredientID
> >>> Quantity
> >>> Measurement ID
> >>> This means that for a given recipe there will be multiple rows in the
> >>> 'IngredientList' table.
> >>> I'm then intending to go on and create 'RecipeList' which will
> >>> contain:
> >>> ID
> >>> Dish ID
> >>> RecipeID
> >>> and so on.
> >>> My question is that it seems like the original 'Dish' table is almost
> >>> pointless, as it will contain hardly any information. the fields will
> >>> be:
> >>> ID
> >>> Name
> >>> Type
> >>> Am I going in the right direction?
> >>> Your help is greatly appreciated.
> >>> Thanks,
> >>> Hugo
> >> According to your definition, what are 'meals' and 'menus'?

>
> > Hugo wrote in email:

>
> > <snip>
> > Meals are multiple dishes, such as 'Ginger Beef' with
> > 'Creamy potato mash' where both 'ginger beef' and 'creamy potato mash'
> > are dishes.

>
> > Menus are multiple dishes such as starter,main and dessert.
> > </snip>

>
> > OK, well in answer to your question, yes - you're on the right lines.
> > Dishes and recipes are the same thing so the Dish table is redundant.
> > If you feel like cheating a little why not visit
> >http://www.databaseanswers.org/data%...index.htmwhich
> > gives an example of a recipe schema.

>
> I disagree. Dishes and recipes are not necessarily the same.
>
> For instance, one might have Steak Tartar with creamed spinach and au
> gratin potatoes. That's three different dishes.
>

Yes, it is 3 different dishes. In my cookbook, that is shown with a
recipe for Steak Tartar, with a suggestion to accompany it with
Creamed Spinach (and a reference to the page that that recipe is found
on) and Gratin Potatoes (with its associated recipe reference).


Reply With Quote
  #7 (permalink)  
Old 10-22-2007
Jerry Stuckle
 
Posts: n/a
Default Re: Relating tables - Another novice question

Captain Paralytic wrote:
> On 22 Oct, 00:58, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> strawberry wrote:
>>> On 20 Oct, 12:05, strawberry <zac.ca...@gmail.com> wrote:
>>>> On Oct 20, 10:58 am, h...@laterooms.com wrote:
>>>>> Hello,
>>>>> I am trying to create a data model to represent meals and menus. As
>>>>> part of this, I have tables:
>>>>> Ingredient
>>>>> Quantity
>>>>> measurement
>>>>> Method
>>>>> Equipment
>>>>> Recipe
>>>>> Dish
>>>>> Meal
>>>>> Menu
>>>>> a recipe can contain multiple ingredients (each with quantities and
>>>>> measurements)
>>>>> a dish can contain multiple recipies
>>>>> A meal can contain multiple dishes and so on.
>>>>> I currently relate the the ingredients and Recipe tables using an
>>>>> 'IngredientList' table which contains fields:
>>>>> ID
>>>>> RecipeID
>>>>> IngredientID
>>>>> Quantity
>>>>> Measurement ID
>>>>> This means that for a given recipe there will be multiple rows in the
>>>>> 'IngredientList' table.
>>>>> I'm then intending to go on and create 'RecipeList' which will
>>>>> contain:
>>>>> ID
>>>>> Dish ID
>>>>> RecipeID
>>>>> and so on.
>>>>> My question is that it seems like the original 'Dish' table is almost
>>>>> pointless, as it will contain hardly any information. the fields will
>>>>> be:
>>>>> ID
>>>>> Name
>>>>> Type
>>>>> Am I going in the right direction?
>>>>> Your help is greatly appreciated.
>>>>> Thanks,
>>>>> Hugo
>>>> According to your definition, what are 'meals' and 'menus'?
>>> Hugo wrote in email:
>>> <snip>
>>> Meals are multiple dishes, such as 'Ginger Beef' with
>>> 'Creamy potato mash' where both 'ginger beef' and 'creamy potato mash'
>>> are dishes.
>>> Menus are multiple dishes such as starter,main and dessert.
>>> </snip>
>>> OK, well in answer to your question, yes - you're on the right lines.
>>> Dishes and recipes are the same thing so the Dish table is redundant.
>>> If you feel like cheating a little why not visit
>>> http://www.databaseanswers.org/data%...index.htmwhich
>>> gives an example of a recipe schema.

>> I disagree. Dishes and recipes are not necessarily the same.
>>
>> For instance, one might have Steak Tartar with creamed spinach and au
>> gratin potatoes. That's three different dishes.
>>

> Yes, it is 3 different dishes. In my cookbook, that is shown with a
> recipe for Steak Tartar, with a suggestion to accompany it with
> Creamed Spinach (and a reference to the page that that recipe is found
> on) and Gratin Potatoes (with its associated recipe reference).
>


Hmmm, do we have the same cookbook? :-)

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Reply With Quote
  #8 (permalink)  
Old 10-22-2007
Captain Paralytic
 
Posts: n/a
Default Re: Relating tables - Another novice question

On 22 Oct, 12:17, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> Captain Paralytic wrote:
> > On 22 Oct, 00:58, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> >> strawberry wrote:
> >>> On 20 Oct, 12:05, strawberry <zac.ca...@gmail.com> wrote:
> >>>> On Oct 20, 10:58 am, h...@laterooms.com wrote:
> >>>>> Hello,
> >>>>> I am trying to create a data model to represent meals and menus. As
> >>>>> part of this, I have tables:
> >>>>> Ingredient
> >>>>> Quantity
> >>>>> measurement
> >>>>> Method
> >>>>> Equipment
> >>>>> Recipe
> >>>>> Dish
> >>>>> Meal
> >>>>> Menu
> >>>>> a recipe can contain multiple ingredients (each with quantities and
> >>>>> measurements)
> >>>>> a dish can contain multiple recipies
> >>>>> A meal can contain multiple dishes and so on.
> >>>>> I currently relate the the ingredients and Recipe tables using an
> >>>>> 'IngredientList' table which contains fields:
> >>>>> ID
> >>>>> RecipeID
> >>>>> IngredientID
> >>>>> Quantity
> >>>>> Measurement ID
> >>>>> This means that for a given recipe there will be multiple rows in the
> >>>>> 'IngredientList' table.
> >>>>> I'm then intending to go on and create 'RecipeList' which will
> >>>>> contain:
> >>>>> ID
> >>>>> Dish ID
> >>>>> RecipeID
> >>>>> and so on.
> >>>>> My question is that it seems like the original 'Dish' table is almost
> >>>>> pointless, as it will contain hardly any information. the fields will
> >>>>> be:
> >>>>> ID
> >>>>> Name
> >>>>> Type
> >>>>> Am I going in the right direction?
> >>>>> Your help is greatly appreciated.
> >>>>> Thanks,
> >>>>> Hugo
> >>>> According to your definition, what are 'meals' and 'menus'?
> >>> Hugo wrote in email:
> >>> <snip>
> >>> Meals are multiple dishes, such as 'Ginger Beef' with
> >>> 'Creamy potato mash' where both 'ginger beef' and 'creamy potato mash'
> >>> are dishes.
> >>> Menus are multiple dishes such as starter,main and dessert.
> >>> </snip>
> >>> OK, well in answer to your question, yes - you're on the right lines.
> >>> Dishes and recipes are the same thing so the Dish table is redundant.
> >>> If you feel like cheating a little why not visit
> >>>http://www.databaseanswers.org/data%...index.htmwhich
> >>> gives an example of a recipe schema.
> >> I disagree. Dishes and recipes are not necessarily the same.

>
> >> For instance, one might have Steak Tartar with creamed spinach and au
> >> gratin potatoes. That's three different dishes.

>
> > Yes, it is 3 different dishes. In my cookbook, that is shown with a
> > recipe for Steak Tartar, with a suggestion to accompany it with
> > Creamed Spinach (and a reference to the page that that recipe is found
> > on) and Gratin Potatoes (with its associated recipe reference).

>
> Hmmm, do we have the same cookbook? :-)
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================- Hide quoted text -
>
> - Show quoted text -


Maybe similar ones. Mine is decorated with samples of the recipes and
their ingredients. I'm sure your copy is pristine ;-)

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:42 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0