Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

SQL Queries. Attached is the ER Diagram for the Database. Also, you can use an i

ID: 3590612 • Letter: S

Question

SQL Queries. Attached is the ER Diagram for the Database. Also, you can use an imaginary recipe database, schema, recipe, column or row name.

Task 1: Pull a full list of ingredients for a recipe

Write query to SELECT ingredients for a recipe.

Task 2: Pull the kCal content for a recipe

Write query to SELECT kCal content for a recipe

Task 3: Find the recipes that can be prepared in under an hour

Recipelngredient Ingredient Recipe PK RepRecipelD RopName PK RecingRecipelngredient longint longint longini varchar(48) varchar(4000) contains ingredients, PK IngingredientID IngName longint used in recipes FK1 RecingRecipelD FK2 RecingingredientID varchar(64) RepDirections longint IngDescription varchar128) RecingAmount varchar15) IngCreated timestamp varchar(64) IngCreated by RepPrepTimeMins int |RepCook Timelins int RepTotalTimelins RepYieldServingsLow int RepingPrepinfo ReplngCreated timestamp IngLastModified timestamp ReplngCreatedBy IngLastModifiedBy RepYieldServingsHigh int RpingLastModified imestamp RopCalsperServing int RpingLastModifiedBy varchar(128) RepSource RopSkillLevelID RepPicturelD line is level SkillLevel longjint HPK SkillID SkillDescription timestamp varchar(16) RepCreated RepCreatedBy SkillCreated imestamp RepLastModified skillCreated by imestamp int has picture details RepLastModifiedBy SkillLastModified imestamp SkillLastModifiedBy Picture PK PicturelD longini varchar(128) PictureCred Picture BLOB PictureCreated imestamp PictureCreatedBy PictureLastMo lodified imestamp PictureLast modifiedBy int

Explanation / Answer

1.
select Receipe.RcpName, Ingredient.IngName
from RecipeIngredient, Receipe, Ingredient
where Receipe.RecingRecipeID = RecipeIngredientRecipeIngredient.RecpReceipeID
and Ingredient.IngIngredientID = RecipeIngredient.RecIngIngredientID
and Receipe.RcpName = '<your receipe name>'


2.
select Receipe.RcpName, Receipe.RcpCalsPerServing as kCal
from Receipe
where Receipe.RcpName = '<your receipe name>'

3.
select Receipe.RcpName, Receipe.RcpPrepTimeMins
from Receipe
where Receipe.RcpPrepTimeMins < 60