First create 4 records in the MC_90_DAYS_MEAL_TYPE table completing the INSERT statements below. You MUST assign...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
First create 4 records in the MC_90_DAYS_MEAL_TYPE table completing the INSERT statements below. You MUST assign a specific PK value to each record. However, all your queries MUST NOT assume those IDs in any circumstances. I will test your queries in my own data, and you will NOT know which MEAL_TYPE_ID I used to create each record, i.e., all filters and condition in queries MUST use the MEAL_TYPE_NAME column. INSERT INTO MC_90_DAYS_MEAL TYPE (MEAL_TYPE_ID, MEAL_TYPE_NAME) VALUES (_________, 'Breakfast'); INSERT INTO MC_90_DAYS_MEAL_TYPE (MEAL_TYPE_ID, MEAL_TYPE_NAME) VALUES ( 'Lunch'); INSERT INTO MC 90 DAYS MEAL TYPE (MEAL_TYPE_ID, MEAL_TYPE_NAME) 'Afternoon snack'); VALUES INSERT INTO MC_90_DAYS_MEAL_TYPE (MEAL_TYPE_ID, MEAL_TYPE_NAME) VALUES ( _,'Dinner'); COMMIT; 4. MENU RECOMMENDATION (Part 2: A random full-day menu) 4.1. Create a procedure MC_CREATE_RANDOM_MENU that produces a random full-day menu, according to the following specification: Parameters: OP_DAY_NUMBER Specifications: o Remove any existing data from tables MC_90_DAYS_MENU and MC_90_DAYS_MENU_ITEM corresponding to the same "Day Number" a. Then, create a random full-day menu recommendation for that specific day, adding menu items into MC_90_DAYS_MENU_ITEM table, according to the following rules for each meal type: Breakfast: o one random item from "Breakfast" category + o one random item from "Coffee & Tea" category Lunch: O one random item from "Salads" category + o one random item from "Beef & Pork" OR "Chicken & Fish" categories (randomly choose one from the two categories above) + O one random item from "Beverages" category + o one random item from "Desserts" category (desserts must be included only in random 50% of the daily menus) Afternoon snack (randomly choose between A or B combinations below): (A) O one random item from "Smoothies & Shakes" category OR (B) o o Dinner: o o o Procedure Code (20 points) Procedure Code Trigger Code one random item from "Coffee & Tea" category + one random item from "Snacks & Sides" category one random item from "Beef & Pork" or "Chicken & Fish" categories (randomly choose one from the two categories above) + one random item from "Beverages" category + one random item from "Desserts" or "Coffee & Tea" categories (randomly choose one from the two categories above) MC_CREATE_RANDOM_MENU CREATE OR REPLACE PROCEDURE MC_CREATE_RANDOM_MENU * Test your procedure and make sure it works before moving to the next task 4.2. Create a trigger MC_90_DAYS_MENU_ITEM_TRG that cumulatively updates all the SUM_* columns in the MC_90_DAYS_MENU table, after each record is created in the MC_90_DAYS_MENU_ITEM table. How-to: a. To calculate the final "SUM_SODIUM_DAILY_PERC" for Recommendation DAY_NUMBER = 1, you must SUM the "SODIUM_PERC_DAILY_VALUE from each menu item included in that daily menu. However, think about how to design that implementation using a FOR EACH ROW trigger (AFTER INSERT) *You DO NOT need to worry about DELETE and UPDATE transaction in this trigger b. All SUM_*_DAILY_PERC column in "MC_90_DAYS MENU" table have a corresponding column in "MC_ MENU_ITEM" table named as *_ PERC_DAILY_VALUE. Trigger Code (20 points) MC_90_DAYS_MENU_ITEM_TRG CREATE OR REPLACE TRIGGER MC_90_DAYS_MENU_ITEM_TRG First create 4 records in the MC_90_DAYS_MEAL_TYPE table completing the INSERT statements below. You MUST assign a specific PK value to each record. However, all your queries MUST NOT assume those IDs in any circumstances. I will test your queries in my own data, and you will NOT know which MEAL_TYPE_ID I used to create each record, i.e., all filters and condition in queries MUST use the MEAL_TYPE_NAME column. INSERT INTO MC_90_DAYS_MEAL TYPE (MEAL_TYPE_ID, MEAL_TYPE_NAME) VALUES (_________, 'Breakfast'); INSERT INTO MC_90_DAYS_MEAL_TYPE (MEAL_TYPE_ID, MEAL_TYPE_NAME) VALUES ( 'Lunch'); INSERT INTO MC 90 DAYS MEAL TYPE (MEAL_TYPE_ID, MEAL_TYPE_NAME) 'Afternoon snack'); VALUES INSERT INTO MC_90_DAYS_MEAL_TYPE (MEAL_TYPE_ID, MEAL_TYPE_NAME) VALUES ( _,'Dinner'); COMMIT; 4. MENU RECOMMENDATION (Part 2: A random full-day menu) 4.1. Create a procedure MC_CREATE_RANDOM_MENU that produces a random full-day menu, according to the following specification: Parameters: OP_DAY_NUMBER Specifications: o Remove any existing data from tables MC_90_DAYS_MENU and MC_90_DAYS_MENU_ITEM corresponding to the same "Day Number" a. Then, create a random full-day menu recommendation for that specific day, adding menu items into MC_90_DAYS_MENU_ITEM table, according to the following rules for each meal type: Breakfast: o one random item from "Breakfast" category + o one random item from "Coffee & Tea" category Lunch: O one random item from "Salads" category + o one random item from "Beef & Pork" OR "Chicken & Fish" categories (randomly choose one from the two categories above) + O one random item from "Beverages" category + o one random item from "Desserts" category (desserts must be included only in random 50% of the daily menus) Afternoon snack (randomly choose between A or B combinations below): (A) O one random item from "Smoothies & Shakes" category OR (B) o o Dinner: o o o Procedure Code (20 points) Procedure Code Trigger Code one random item from "Coffee & Tea" category + one random item from "Snacks & Sides" category one random item from "Beef & Pork" or "Chicken & Fish" categories (randomly choose one from the two categories above) + one random item from "Beverages" category + one random item from "Desserts" or "Coffee & Tea" categories (randomly choose one from the two categories above) MC_CREATE_RANDOM_MENU CREATE OR REPLACE PROCEDURE MC_CREATE_RANDOM_MENU * Test your procedure and make sure it works before moving to the next task 4.2. Create a trigger MC_90_DAYS_MENU_ITEM_TRG that cumulatively updates all the SUM_* columns in the MC_90_DAYS_MENU table, after each record is created in the MC_90_DAYS_MENU_ITEM table. How-to: a. To calculate the final "SUM_SODIUM_DAILY_PERC" for Recommendation DAY_NUMBER = 1, you must SUM the "SODIUM_PERC_DAILY_VALUE from each menu item included in that daily menu. However, think about how to design that implementation using a FOR EACH ROW trigger (AFTER INSERT) *You DO NOT need to worry about DELETE and UPDATE transaction in this trigger b. All SUM_*_DAILY_PERC column in "MC_90_DAYS MENU" table have a corresponding column in "MC_ MENU_ITEM" table named as *_ PERC_DAILY_VALUE. Trigger Code (20 points) MC_90_DAYS_MENU_ITEM_TRG CREATE OR REPLACE TRIGGER MC_90_DAYS_MENU_ITEM_TRG
Expert Answer:
Related Book For
Data Modeling and Database Design
ISBN: 978-1285085258
2nd edition
Authors: Narayan S. Umanath, Richard W. Scammel
Posted Date:
Students also viewed these databases questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Assume that your team has been in contract with the headquarters of a company that owns several restaurants in different states in the US. Your team is to provide software that manages these...
-
Susan and Stan Collins live in Iowa, are married and have two children ages 6 and 10. In 2018, Susans income is $38,290 and Stans is $12,000 and both are self-employed. They also have $500 in...
-
In Problems below, f '(x) and its graph are given. (a) Use the graph of f '(x) to determine (estimate) where the graph of f (x) is increasing, where it is decreasing, and where it has relative...
-
Use Holt-Winters multiplicative method to create a seasonal model that minimizes the MSE for the data set. Use Solver to determine the optimal values of , , and . a. What are the optimal values of ,...
-
Assume a job with one stair climber requires 5 direct labor (DL) hours to produce: 3 DL hours in the Machining Department and 2 DL hours in the Assembly Department. Use the plantwide overhead rate...
-
Cost centers, profit centers, decentralization, transfer prices. Fenster Corporation manufactures windows with wood and metal frames. Fenster has three departments: Glass, Wood, and Metal. The Glass...
-
All work must be shown on every facet of the solution. This includes a timeline with cashflows, timing and rates clearly laid out and formulas (in pure form, not in the calculator or excel form). A...
-
The following two situations involve the capitalization of borrowing costs. Situation I: On January 1, 2022, Columbia Outfitters signed a fixed-price contract to have Builder Associates construct a...
-
Upon entering your work site for the day (at 3pm), your supervisor informs you of three problems you will need to address. The three issues are as follows: -Client (Mary) is out of her 4pm...
-
XYZ Insurance Corporation. XYZ Insurance Corporation is a leading global insurance organization serving business and individuals with a broad range of insurance products and insurance-related...
-
In a recent class-action lawsuit, California and New York residents sued the Kellogg Company for false advertising, based on the packaging of the company's Cheez-It crackers. The Cheez-It packaging...
-
Physical Computing on the Raspberry Pi to set up the Pi to control an LED. Help create a program in Python that: - Converts the String "Hello World" to Morse code - Causes the LED to blink "Hello...
-
Urban Economy Suppose that each acre of agricultural land yields b dollars of open-space benefits to society, over and above the private benefits it produces. Landowners rent the agricultural land to...
-
2. A plain concrete cylinder with dimensions of 12" height and 6" diameter is tested using spilt tension test. The failure load was measured to be 70 kN. What is the indirect tensile strength of...
-
A two-phase liquidvapor mixture of H 2 O has a temperature of 300 o C and occupies a volume of 0.05 m 3 . The masses of saturated liquid and vapor present are 0.75 kg and 2.26 kg, respectively....
-
Representative data read from a plot that appeared in the paper Effect of Cattle Treading on Erosion from Hill Pasture: Modeling Concepts and Analysis of Rainfall Simulator Data (Australian Journal...
-
Give an example of a relationship type between two entity types where an attribute can be assigned to the relationship type instead of to one of the two entity types.
-
Distinguish between a simple attribute, a single-valued attribute, a composite attribute, a multi-valued attribute, and a complex attribute. Develop an example similar to Figure 2.3 that illustrates...
-
What is the difference between the result obtained from a section operation versus a Projection operation?
-
(a) Determine the critical values for a right-tailed test of a standard population deviation with 18 degrees of freedom at \(\alpha=0.1\) level of significance. (b) Determine the critical values for...
-
To test \(H_{0}: \sigma=50\) versus \(H_{1}: \sigma <50\), a random sample of size \(n=24\) is obtained from a population that is known to be normally distributed. (a) If the sample standard...
-
In Example 2 from Section 10.3, the quality-control engineer for M\&MMars tested whether the mean weight of fun-size Snickers was 20.1 grams. Suppose that the standard deviation of the weight of the...
Study smarter with the SolutionInn App