Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ONLY DO THIS USING SQL DEVELOPER (ORACLESQL). And using the following tables (Tables for Part 1 and2) : CREATE TABLE Customers ( Cust_id int PRIMARY

ONLY DO THIS USING SQL DEVELOPER (ORACLESQL).

And using the following tables (Tables for Part 1 and2):

CREATE TABLE Customers
(
Cust_id int PRIMARY KEY,
Last_Name varchar(255),
First_Name varchar(255),
State varchar(255),
Zipcode Number(10)
);

CREATE TABLE Customers_history
(
History_id int PRIMARY KEY,
Cust_id int,
Last_Name varchar(255),
First_Name varchar(255),
State varchar(255),
Zipcode Number(10)
);

TEST CODE BEFORE POSTING SOLUTION.

Your assignment is to create an auditing policy that keeptrack of insertion and update activities of Customers table. ThisCustomers trigger fires before update or insert or delete oncustomers. You have to test your trigger and provide screenshots toprove that it works correctly

D1. Create a new table named Customers. Thenew table should have at least 5 columns including a primary key.(Cust-id, First_name, Last_name, State, Zip-code. Use cust_id asPK.

D2. Insert 2 rows into the Customers table.

D3. Create a history table for Customers table, (createtable customers_history). The table should have same structure asCustomers table Cust-id + First_name + Last_name+ State + Zip_code.Don't forget the history_id as pk . Do NOT insert anydata (values) into this table.

D4. Create a trigger for auditing?create triggeraudit_customers on the Custoners table

D5. Insert 3 records into the Customers table.

D4. Retrieve all rows from customers and customers-historytable to verify that rows were added to the Customers table andthat the trigger is populating the customers-historytable.

D5. Now update the zip code of one customer and check ifrows were added to the customers table and that the trigger didpopulate the customers-history table with the new zipcode.

D6. Update the first record of Customers, and then deletethis record.

D7. Display the content of Customers table and the historytable.

You have to provide the trigger code, code you used to createthe table and insert records. (2 points)

Step by Step Solution

3.44 Rating (154 Votes )

There are 3 Steps involved in it

Step: 1

ANSWER D1 Create a new table named Customers The new table shouldhave at least 5 columns including a primary key Custid Firstname Lastname State Zipco... 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

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Electrical Engineering questions

Question

Why is increased efficiency an advantage in a distributed database?

Answered: 1 week ago

Question

What is a sub query? When is a sub query executed?

Answered: 1 week ago

Question

7. For what kinds of patients is ECT recommended?

Answered: 1 week ago

Question

5. What are the effects of MAOIs?

Answered: 1 week ago