ONLY DO THIS USING SQL DEVELOPER (ORACLE SQL). And using the following tables (Tables for Part 1 …
ONLY DO THIS USING SQL DEVELOPER (ORACLE SQL).
And using the following tables (Tables for Part 1 and 2):
CREATE TABLE Customers
Cust_id int PRIMARY KEY,
CREATE TABLE Customers_history
History_id int PRIMARY KEY,
TEST CODE BEFORE POSTING SOLUTION.
Your assignment is to create an auditing policy that keep track of insertion and update activities of Customers table. This Customers trigger fires before update or insert or delete on customers. You have to test your trigger and provide screenshots to prove that it works correctly
D1. Create a new table named Customers. The new table should have at least 5 columns including a primary key. (Cust-id, First_name, Last_name, State, Zip-code. Use cust_id as PK.
D2. Insert 2 rows into the Customers table.
D3. Create a history table for Customers table, (create table customers_history). The table should have same structure as Customers table Cust-id + First_name + Last_name+ State + Zip_code. Don’t forget the history_id as pk . Do NOT insert any data (values) into this table.
D4. Create a trigger for auditing?create trigger audit_customers on the Custoners table
D5. Insert 3 records into the Customers table.
D4. Retrieve all rows from customers and customers-history table to verify that rows were added to the Customers table and that the trigger is populating the customers-history table.
D5. Now update the zip code of one customer and check if rows were added to the customers table and that the trigger did populate the customers-history table with the new zip code.
D6. Update the first record of Customers, and then delete this record.
D7. Display the content of Customers table and the history table.
You have to provide the trigger code, code you used to create the table and insert records. (2 points)