> -----Original Message-----
> From: Ricardo Fitzgerald [mailto:[EMAIL PROTECTED]] 
> Sent: Sunday, December 22, 2002 11:22 AM
> To: [EMAIL PROTECTED]
> Subject: Help with database Design
> 
> 
create table recipes(
rid int not null primary key,
rname ....) ;

create table ingredient(
iid int not null,
rid int not null,               # references recipe.rid
ridorder int not null,  # order of this ingredient in recipe
PRIMARY KEY(iid,rid,ridorder),
iname ...) ;

HTH,

Adolfo
> Hi,
> 
> I'm having problems trying to figure which is the best way to 
> solve a design
> :
> 
> I'm designing a delivery program with php and mysql, and I'm 
> having troubles with some tables, my problem is with the 
> recipes, the recipes are divided into two tables one with a 
> recipe id and description the other detailing the 
> ingredients, of each particular recipe, that's where my 
> problem starts because each ingredient is not unique and even 
> it appears in many recipes, and another thing is every time 
> and item is ordered their correspondent recipe ingredients 
> are added , ie. pizza has a code 11, recipe has code 01 then 
> all the ingredients in the recipe table have different 
> ingredient code each, and are related by the recipe code 01, 
> then each separate item must be counted, and added to the 
> ingredients general daily totals, I mean pizza uses 2 
> tomatoes then the general total will show two tomatoes and 
> each other ingredient. There are also some combined recipes : 
> Pizza with a special sauce, then this item has to query two 
> parts of the same table, say code 12 is Pizza with a combined 
> sauce of mushrooms and milk, and pineapples, so each 
> ingredient must be added to the general total. I need help 
> with the design because I don't want to have database anomalies.
> 
> Thank you all,
> 
> Merry Xmas
> Rick
> 
> 
> ______________________________________________________________
> ____ Omni
> ICQ#: 37031810 Current ICQ status: + More ways to contact me 
> __________________________________________________________________
> 
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail 
> <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 
> 
> 
> 


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to