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

Task 1: Add a \"tags\" table and a \"recipe_tags\" bridge to map recipes to tags

ID: 3597352 • Letter: T

Question

Task 1: Add a "tags" table and a "recipe_tags" bridge to map recipes to tags (and vice versa)

Write script to CREATE tables for tagging. Each tag should be able to be used on any number of recipes, and each recipe should be able to have unlimited tags.

Task 2: Tag existing recipes as "last-minute" or "low-cal"

Use INSERT to tag recipes with the "last minute" (for recipes that take under one hour) and "low-cal" tags

Recipe Recipelngredient Ingredient longint varchar(48) varchar(4000) PK RcpRecipelD longint varchar(64) varchar(128) timestamp int timestamp int PK InglngredientID PK ReclngRecipelngredientID longint FK1 RecIngRecipelD FK2 ReclngingredientID contains used in ingredient:s RcpName RcpDirections RcpPrepTimeMinsint RcpCookTimeMins int RcpTotalTimeMins nt RcpYieldServingsLow int RcpYieldServingsHigh int RcpCalsPerServing int RcpSource RcpSkillLevelID RcpPicturelD RcpCreatec RcpCreatedBy longint ongint varchar(16) varchar(64) timestamp int timestamp ReclngAmount RcplngPreplnfo RcplngCreated RcplngCreatedBy RcplngLastModified RcplngLastModifiedBy IngName IngDescription IngCreated IngCreatedBy IngLastModified IngLastModifiedBy varchar(128) int int timestamp int timestamp SkillLevel PK SkillD longint varchar(16) timestamp SkillDescription SkillCreated SkillCreatedBy SkillLastModified SkillLastModifiedBy as picture details RcpLastModifiedBy int timestamp int Picture PK PicturelD PictureCredit Picture PictureCreated PictureCreatedBy PictureLastModified timestamp PictureLastModifiedBy int longint varchar(128) BLOB timestamp int

Explanation / Answer

Script 1:

CREATE TABLE Tags(TagId int NOT NULL PRIMARY KEY, TagName Varchar2(20));

Script 2:

CREATE TABLE Recipe_Tags(RcpRecipeId longint PRIMARY KEY, TagId PRIMARY KEY)

This is an example for many-to-many relationship. If one or more items in one table is related to one or more items in another table is called many-to-many relationship.

Here Recipe and Tags are the two different tables. These two tables should map with each other in many-to-many relationship. To create many-to-many relationship we need a thired table(Recipe_Tags) to connect these two. This 'Recipe_Tags' called 'intermediate table'.

In our scenario, we have to combine two primary keys of these two table in the third table(Recipe_Tags).

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote