PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > Relating tables - Another novice question
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Relating tables - Another novice question

Réponse
 
LinkBack Outils de la discussion
Vieux 20/10/2007, 11h58   #1
hugo@laterooms.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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 is greatly appreciated.

Thanks,

Hugo

  Réponse avec citation
Vieux 20/10/2007, 12h29   #2
J.O. Aho
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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
  Réponse avec citation
Vieux 20/10/2007, 13h05   #3
strawberry
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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 is greatly appreciated.
>
> Thanks,
>
> Hugo


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

  Réponse avec citation
Vieux 21/10/2007, 14h02   #4
strawberry
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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 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.

  Réponse avec citation
Vieux 22/10/2007, 01h58   #5
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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 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
==================

  Réponse avec citation
Vieux 22/10/2007, 10h29   #6
Captain Paralytic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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 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).


  Réponse avec citation
Vieux 22/10/2007, 13h17   #7
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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 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
==================

  Réponse avec citation
Vieux 22/10/2007, 13h34   #8
Captain Paralytic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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 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 ;-)

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 01h04.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,25682 seconds with 16 queries