Question: Q 5 . ( 1 5 points ) Trigger based on table Locations. It requires three steps described below. The first step is to create

Q5.(15 points) Trigger based on table Locations. It requires three steps described below.
The first step is to create a log table Log_Location. Similar to the log tables in class notes or assignments, the table should have the necessary columns needed for tracking any changes mentioned below.
The second step: for monitoring the changes of table Locations, you will create a conditional predicates row-level trigger called Location_monitor. Whenever there is a command of insert, delete, or update on two special columns of location_id or the city, the trigger will be fired, and a row will be inserted into the table Log_Location with correspondent "action" comments. Your trigger should not be fired when there is change of columns other than the location_id and city. The Log table should record the event date, who is that login name, and the correspondent action.
Step three: after you have successfully built the trigger, you are required to test your trigger using the following commands, and submit the correspondent outputs of the log table.
INSERT INTO LOCATIONS VALUES
(4000,'243 S. Wabash Ave', '60604',
'Chicago', 'IN','US');
UPDATE LOCATIONS
SET city = 'York' WHERE Location_id =
4000 ;
UPDATE LOCATIONS
SET Street_address ='1 E. Jackson' WHERE
Location_id =4bar(0)00;
UPDATE LOCATIONS SET Location_id =4111 WHERE
Location_id =4000;
DELETE LOCATIONS WHERE Location_id =4111;
SELECT * FROM Log_Location;
-- please submit your output of these
commands.
-- ROLLBACK; -- cleaning after submitting the
result
 Q5.(15 points) Trigger based on table Locations. It requires three steps

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!