I'm making a cocktail database, and right now I have three tables:
- drinks has columns drinks_id and drinks_name
- ingredients has columns ingredients_id and ingredients_name
- The third is a simple relationship table called recipes that has drinks_id and ingredients_id
I want to query the database with a set of ingredient_ids and get the set of drinks available from that set of ingredients. For example, if drink A contains ingredients (1,2), drink B contains (1,3), and drink C contains (1,2,3), inputting ingredients 1,2 and 3 should return drinks A, B and C. I just started teaching myself database design with MySQL and any help is much appreciated. Sorry if this has been answered elsewhere, I tried but didn't quite know how to search for it.
TRY