What's the easiest way to implement division in SQLite?
0
votes
1
answer
303
views
I'm putting together a simple cooking application that holds recipes in an SQLite database. I have three tables right now: Recipes, Ingredients, Recipe_Ingredients
* Recipes
-------------------
name,
-------------------
Lentil Soup
Egg Drop Soup
* Ingredients
-------------------
name,
-------------------
Lentils
Chicken Broth
Tomato
Egg
Onion
* Recipe_Ingredients
-------------------
recipe, ingredient
-------------------
Lentil Soup, Lentils
Lentil Soup, Chicken Broth
Lentil Soup, Tomato
Egg Drop Soup, Egg
Egg Drop Soup, Chicken Broth,
Egg Drop Soup, Onion
I want my application to be able to return recipes based on the ingredients I have available. Something like: "show me all recipes that include both Chicken Broth and Egg".
My SQL is a bit rusty, however, it seems like I would want to use SQL division to essentially divide out all recipes that include both of these ingredients.
Can anyone provide an easy SQL division implementation that SQLite supports?
Asked by Izzo
(141 rep)
Jan 30, 2023, 07:03 PM
Last activity: Mar 16, 2023, 01:37 PM
Last activity: Mar 16, 2023, 01:37 PM