Question: Write a script according to the following specifications. i) Create a table, named audit_trail, for storing an audit trail record. It suffices to include one

Write a script according to the following specifications.

i) Create a table, named audit_trail, for storing an audit trail record. It suffices to include one column of a variable length character string. Hint: feel free to use the same one used in a trigger example code in class.

ii) Create four types of triggers before_table, after_table, before_row, and after_row (and named as such, i.e.., before_table, after_table, before_row, and after_row) with the event defined on update of the salary column of the table Employee and the action specified as writing an audit record into the table created in step 1. Make each audit record as Before_table trigger fired., After_table trigger fired., Before_row trigger fired., and After_row trigger fired.

iii) Fire the triggers created in the step ii by executing an SQL update statement for raising the salaries of all employees by 10%. This single statement fires all four triggers.

iv) Show the content of the audit records by executing an SQL select statement.

v) Drop the audit_trail table and the four triggers.

vi) Restore the original salary values of the Employee tuples by executing an SQL update statement.

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!