Question: Using the following database creation SQL code: USE MenuDatabase CREATE TABLE [dbo].[Menu]( [ID] INT PRIMARY KEY, [MenuTitle] [nvarchar](50) NULL, [MenuDescriptionText] [nvarchar](50) NULL) CREATE TABLE [dbo].[MenuGroups](

Using the following database creation SQL code:

USE MenuDatabase CREATE TABLE [dbo].[Menu]( [ID] INT PRIMARY KEY, [MenuTitle] [nvarchar](50) NULL, [MenuDescriptionText] [nvarchar](50) NULL) CREATE TABLE [dbo].[MenuGroups]( [ID] INT PRIMARY KEY, [MenuID] INT NOT NULL, [MenuGroupText] [nvarchar](50) NOT NULL, [MenuGroupDescriptionText] [nvarchar](50) NULL, FOREIGN KEY (MenuID) REFERENCES Menu(ID)) CREATE TABLE [dbo].[MenuItems]( [ID] INT PRIMARY KEY, [MenuGroupsID] INT NOT NULL, [MenuItemTitle] [nvarchar](50) NOT NULL, [MenuItemDescriptionText] [nvarchar](50) NULL, FOREIGN KEY (MenuGroupsID) REFERENCES MenuGroups(ID)) CREATE TABLE [dbo].[Ingredients]( [ID] INT PRIMARY KEY, [IngredientTitleText] [NVARCHAR](50) NOT NULL, [IngredientDescriptionText] [NVARCHAR](200) NULL ) CREATE TABLE [dbo].[IngredientsInItems]( [ID] INT PRIMARY KEY, [IngredientsID] INT NOT NULL, [MenuItemID] INT NOT NULL, [DescriptionText] [NVARCHAR](200), FOREIGN KEY (IngredientsID) REFERENCES Ingredients(ID), FOREIGN KEY (MenuItemID) REFERENCES MenuItems(ID)) 

You will create a stored procedure to insert a menu item into the database. It must check to see if unique data elements exist in the database. Here are the steps;

sp_InsertNewMenuItem

1. The stored procedure should accept as arguments (at a minimum) MenuTitle, MenuGroupText, MenuItemTitle

2. The stored procedure should check to see if the MenuTitle exists, if not, create a new Menu if so use the ID

3. The stored procedure should check to see if the MenuGroupText exists, if not, create a new MenuGroup if so use the ID

4. The stored procedure should create a new MenuItem

5. Create a stored procedure sp_InsertIngredient that INSERTS an ingredient and places it in a Menu Item.

Test Data:

Create a Basic Taco (often called the American Taco on menus. Tacos should be in the MenuGroup Tacos, which will have multiple tacos in it. One of your Tacos should have the Ingredients;

Ground Beef Tomatoes Onions Lettuce Salsa

Create a second taco with your ingredients.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!