If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Help with drink database design

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-25-11, 11:07
shivangp shivangp is offline
Registered User
 
Join Date: Dec 2011
Posts: 2
Help with drink database design

I'm trying to design a drink database and need some help with the design.

I created the following tables: an ingredients table that lists all possible ingredients (i.e. rum, coke, vodka and orange juice). A drinks table with a list of all possible drinks (i.e. "rum & coke", "screwdriver"). Finally a Recipes tables describes how to make the drink, so for "rum & coke" there are two entires one with the ingredients ID for rum and one for ingredients ID for coke both with a foreign key to the same drink id.

What I want to do is given a list of available ingredients id - 1(rum), 2(coke) and 3(vodka) I want to come up with a list of drinks that are possible to make. So I can make rum & coke but not a screw driver because I don't have orange juice.

Any suggestions on how to write such a select statement or how to better design the tables?

Thanks
Reply With Quote
  #2 (permalink)  
Old 12-25-11, 12:55
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
teh tabl dezigngs are okj hic

what if you have ony 2 oz of vodka, hell, i have even less but i'm saving the last swig

so you need "qty" quantititity (heh) column as well eh

hey i still have half a bottle of rum here

do you wnat your query to be able to make any qty drink?

like for instance a really dry martini is mostly gin and kind of wave the vermouth cork over the glass

i speak from considerable experience

hey i still have almost half a bottle of rum here
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 12-25-11, 15:42
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
Quote:
Originally Posted by r937 View Post
like for instance a really dry martini is mostly gin and kind of wave the vermouth cork over the glass
Quoted for truth.
Reply With Quote
  #4 (permalink)  
Old 12-26-11, 09:02
shivangp shivangp is offline
Registered User
 
Join Date: Dec 2011
Posts: 2
That's for the reply - I don't need to query for the quantity I'm assuming there's always plenty of liquor to go around.
Reply With Quote
  #5 (permalink)  
Old 12-26-11, 14:23
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
Quote:
Originally Posted by shivangp View Post
That's for the reply - I don't need to query for the quantity I'm assuming there's always plenty of liquor to go around.
I have my doubts about that especially with those two topers on your case
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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