Task 1: Add a \"tags\" table and a \"recipe_tags\" bridge to map recipes to tags
ID: 3593484 • Letter: T
Question
Task 1: Add a "tags" table and a "recipe_tags" bridge to map recipes to tags (and vice versa)
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 intExplanation / 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).
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.