[SOLVED] Assignment 14 (Chapter 15 Triggers, 10 points for Q1 and 30 points for Q2)

25.00 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

5/5 - (2 votes)

Q1. (10 points)
A product in the Products_copy may or may not have a unit price. Create an AFTER trigger called ‘tgr_priceValidation’ to ensure  that, if a product has a unit price, it must not be at least $0.50  but no higher than $500.00. Any attempt that violates this rule will be aborted by this trigger and receive an error 51234 with
a message “No product is allowed to have a unit price out of the range between $0.50 and $500.00.”

Note that any action query, i.e., INSERT, DELETE, and UPDATE, can affect more than one row of data. So, if multiple products are affected by an action query, your trigger must be able to examine all of them in order to satisfy the above business rule.

Several test cases are provided for your testing. If toyr trigger is implemented correctly, you should get the passed/failed results as shown in each test case.

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.