This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE VIEW view_recipe_by_ingredient AS | |
SELECT R.id, R.name, RI.liquorID | |
FROM recipes R | |
JOIN recipeIngredients RI ON RI.recipeID = R.id; | |
CREATE VIEW view_recipes_in_cabinet AS | |
SELECT L.userID, RbI.name, RbI.id, COUNT( RbI.liquorID ) as LiquorCount | |
FROM view_recipe_by_ingredient RbI | |
LEFT JOIN liquorCabinet L USING (liquorID) | |
GROUP BY RbI.name; |