Question: 1 . Write a script that creates and calls a stored procedure named insert _ category. First, code a statement that creates a procedure that
Write a script that creates and calls a stored procedure named insertcategory. 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. Include exception handling block.
Code at least two CALL statements that test this procedure. Note that this table doesn't allow duplicate category names.
Write a script that creates and calls a stored function named discountprice that calculates the discount price of an item in the OrderItems 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.
Code a SELECT statement that tests this function.
Create a trigger named productsbeforeupdate that checks the new value for the discountpercent column of the Products table. This trigger should raise an appropriate error if the discount percent is greater than or less than
If the new discount percent is between and this trigger should modify the new discount percent by multiplying it by That way, a discount percent of becomes
Test this trigger with an appropriate UPDATE statement.
Create a trigger named productsbeforeinsert that inserts the current date for the dateadded column of the Products table if the value for that column is null.
Test this trigger with an appropriate INSERT statement.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
