Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

script that creates and calls a stored procedure named insert_category. First, code a statement that creates a procedure that adds a new row to the

script that creates and calls a stored procedure named insert_category. First, code a statement that creates a procedure that adds a new row to the Categories table. To do that, this procedure should have one parameter for the category name.

Code at least two CALL statements that test this procedure. (Note that this table doesn't allow duplicate category names.)

script that creates and calls a stored function named discount_price that calculates the discount price of an item in the Order_Items table (discount amount subtracted from item price). To do that, this function should accept one parameter for the item ID, and it should return the value of the discount price for that item.

script that creates and calls a stored function named item_total that calculates the total amount of an item in the Order_Items table (discount price multiplied by quantity). To do that, this function should accept one parameter for the item ID, it should use the discount_price function that you created in exercise 2, and it should return the value of the total for that item.

script that creates and calls a stored procedure named insert_products that inserts a row into the Products table. This stored procedure should accept five parameters, one for each of these columns: category_id, product_code, product_name, list_price, and discount_percent.

This stored procedure should set the description column to an empty string, and it should set the date_added column to the current date.

If the value for the list_price column is a negative number, the stored procedure should raise an error that indicates that this column doesn't accept negative numbers. Similarly, the procedure should raise an error if the value for the discount_percent column is a negative number.

Code at least two CALL statements that test this procedure.

script that creates and calls a stored procedure named update_product_discount that updates the discount_percent column in the Products table. This procedure should have one parameter for the product ID and another for the discount percent.

If the value for the discount_percent column is a negative number, the stored procedure should raise an error that the value for this column must be a positive number.

Code at least two CALL statements that test this procedure.

 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation and Management

Authors: Carlos Coronel, Steven Morris

11th edition

9781305323230, 1285196147, 1305323238, 978-1285196145

More Books

Students also viewed these Databases questions

Question

At which conferences do students regularly present?

Answered: 1 week ago

Question

where the hell is the rest of these

Answered: 1 week ago