Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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
image text in transcribed

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

Step: 3

blur-text-image

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: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions