SlideShare a Scribd company logo
1 of 3
Download to read offline
Using SQL Developer ONLY!
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 table
D5. Insert 3 records into the Customers table.
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.
Solution
/** [D1]**/
CREATE TABLE Customers1 (
Cust_id Number (8),
First_name varchar2(20),
Last_name varchar2(20),
State varchar2 (20),
Zip_code Number (9),
Primary key (Cust_id)
);
/***[D2]***/
Insert into Customers1 values ( 1, 'David','Smith', 'Virginia', 300050);
Insert into Customers1 values ( 2, 'Vinsel', 'Nalla', 'NYK', 300051);
/**[D3]**/
CREATE TABLE Customers1_history (
history_id Number (8) ,
Cust_id Number (8),
First_name varchar2(20),
Last_name varchar2(20),
State varchar2 (20),
Zip_code Number (9),
Primary key (history_id)
);
/**** [D4]*********
I have used MErge concept for this.
Trigger invoke for each delete , update , insert statement on
Clients Table.
**************************/
create or replace
TRIGGER audit_Customers1
BEFORE INSERT OR UPDATE OR DELETE ON Customers1
BEGIN
MERGE INTO Customers1_history d
USING Customers1 s
ON (d.Cl_id = s.Cl_id)
WHEN MATCHED THEN
UPDATE SET d.Zip_code = s.Zip_code
WHEN NOT MATCHED THEN
Insert (d.History_id,d.Cl_id , d.F_name , d.L_name , d.State ,d.Zip_code )
values (s.cl_id, s.Cl_id , s.F_name , s.L_name , s.State ,s.Zip_code);
END audit_Customers1;
/*** [D5] ******/
Insert into Customers1 values ( 3, 'Thersa', 'john', 'Londan', 300152);
Insert into Customers1 values ( 4, 'rahul', 'modi', 'delhi', 300153);
Insert into Customers1 values ( 5, 'aamir', 'khan', 'Iran', 300154);
/**** [D6] ******/
UPDATE Customers1
SET Zip_code = 123456
WHERE Cust_id = 1;
DELETE FROM Customers1
WHERE Cust_id = 1;
/******** [D7] ********/
SELECT * FROM Customers1;
SELECT * FROM Customers1_history;

More Related Content

Similar to Using SQL Developer ONLY!Your assignment is to create an auditing .pdf

on SQL Managment studio(For the following exercise, use the Week 5.pdf
on SQL Managment studio(For the following exercise, use the Week 5.pdfon SQL Managment studio(For the following exercise, use the Week 5.pdf
on SQL Managment studio(For the following exercise, use the Week 5.pdfformaxekochi
 
Les09 (using ddl statements to create and manage tables)
Les09 (using ddl statements to create and manage tables)Les09 (using ddl statements to create and manage tables)
Les09 (using ddl statements to create and manage tables)Achmad Solichin
 
Custom Star Creation for Ellucain's Enterprise Data Warehouse
Custom Star Creation for Ellucain's Enterprise Data WarehouseCustom Star Creation for Ellucain's Enterprise Data Warehouse
Custom Star Creation for Ellucain's Enterprise Data WarehouseBryan L. Mack
 
IBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql FeaturesIBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql FeaturesKeshav Murthy
 
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project A
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project ADN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project A
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project ADataconomy Media
 
chap 7.ppt(sql).ppt
chap 7.ppt(sql).pptchap 7.ppt(sql).ppt
chap 7.ppt(sql).pptarjun431527
 
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowOTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowOTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
Desain dan Implementasi Basisdata (Praktikum)
Desain dan Implementasi Basisdata (Praktikum)Desain dan Implementasi Basisdata (Praktikum)
Desain dan Implementasi Basisdata (Praktikum)MSyahidNurWahid
 
Greg Lewis SQL Portfolio
Greg Lewis SQL PortfolioGreg Lewis SQL Portfolio
Greg Lewis SQL Portfoliogregmlewis
 
Multiple files single target single interface
Multiple files single target single interfaceMultiple files single target single interface
Multiple files single target single interfaceDharmaraj Borse
 

Similar to Using SQL Developer ONLY!Your assignment is to create an auditing .pdf (20)

on SQL Managment studio(For the following exercise, use the Week 5.pdf
on SQL Managment studio(For the following exercise, use the Week 5.pdfon SQL Managment studio(For the following exercise, use the Week 5.pdf
on SQL Managment studio(For the following exercise, use the Week 5.pdf
 
Database design
Database designDatabase design
Database design
 
DOODB_LAB.pptx
DOODB_LAB.pptxDOODB_LAB.pptx
DOODB_LAB.pptx
 
1 z1 051
1 z1 0511 z1 051
1 z1 051
 
Les09
Les09Les09
Les09
 
Sql
SqlSql
Sql
 
Oraclesql
OraclesqlOraclesql
Oraclesql
 
Sql commands
Sql commandsSql commands
Sql commands
 
Les09 (using ddl statements to create and manage tables)
Les09 (using ddl statements to create and manage tables)Les09 (using ddl statements to create and manage tables)
Les09 (using ddl statements to create and manage tables)
 
Custom Star Creation for Ellucain's Enterprise Data Warehouse
Custom Star Creation for Ellucain's Enterprise Data WarehouseCustom Star Creation for Ellucain's Enterprise Data Warehouse
Custom Star Creation for Ellucain's Enterprise Data Warehouse
 
PL/SQL TRIGGERS
PL/SQL TRIGGERSPL/SQL TRIGGERS
PL/SQL TRIGGERS
 
IBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql FeaturesIBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql Features
 
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project A
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project ADN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project A
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project A
 
chap 7.ppt(sql).ppt
chap 7.ppt(sql).pptchap 7.ppt(sql).ppt
chap 7.ppt(sql).ppt
 
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowOTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
 
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowOTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
 
SQL(database)
SQL(database)SQL(database)
SQL(database)
 
Desain dan Implementasi Basisdata (Praktikum)
Desain dan Implementasi Basisdata (Praktikum)Desain dan Implementasi Basisdata (Praktikum)
Desain dan Implementasi Basisdata (Praktikum)
 
Greg Lewis SQL Portfolio
Greg Lewis SQL PortfolioGreg Lewis SQL Portfolio
Greg Lewis SQL Portfolio
 
Multiple files single target single interface
Multiple files single target single interfaceMultiple files single target single interface
Multiple files single target single interface
 

More from mohammedfootwear

Getting some errors when trying to run this program, can anyone help.pdf
Getting some errors when trying to run this program, can anyone help.pdfGetting some errors when trying to run this program, can anyone help.pdf
Getting some errors when trying to run this program, can anyone help.pdfmohammedfootwear
 
Discuss what is meant by Project Scope ManagementSolutionA pr.pdf
Discuss what is meant by Project Scope ManagementSolutionA pr.pdfDiscuss what is meant by Project Scope ManagementSolutionA pr.pdf
Discuss what is meant by Project Scope ManagementSolutionA pr.pdfmohammedfootwear
 
Determine if statement is true or false. If johnny likes suzy the ri.pdf
Determine if statement is true or false. If johnny likes suzy the ri.pdfDetermine if statement is true or false. If johnny likes suzy the ri.pdf
Determine if statement is true or false. If johnny likes suzy the ri.pdfmohammedfootwear
 
Describe one safeguard that should be in place to protect the confid.pdf
Describe one safeguard that should be in place to protect the confid.pdfDescribe one safeguard that should be in place to protect the confid.pdf
Describe one safeguard that should be in place to protect the confid.pdfmohammedfootwear
 
Create a storyboard prototype of a mobile app.When creating a stor.pdf
Create a storyboard prototype of a mobile app.When creating a stor.pdfCreate a storyboard prototype of a mobile app.When creating a stor.pdf
Create a storyboard prototype of a mobile app.When creating a stor.pdfmohammedfootwear
 
Are you familiar with the term parochialism What could be happen.pdf
Are you familiar with the term parochialism What could be happen.pdfAre you familiar with the term parochialism What could be happen.pdf
Are you familiar with the term parochialism What could be happen.pdfmohammedfootwear
 
Answer the question, What market structure is the airline industry.pdf
Answer the question, What market structure is the airline industry.pdfAnswer the question, What market structure is the airline industry.pdf
Answer the question, What market structure is the airline industry.pdfmohammedfootwear
 
Adding methods to the ListBag classIn the file ListBag.py, add the.pdf
Adding methods to the ListBag classIn the file ListBag.py, add the.pdfAdding methods to the ListBag classIn the file ListBag.py, add the.pdf
Adding methods to the ListBag classIn the file ListBag.py, add the.pdfmohammedfootwear
 
5. value 10.00 polnts On May 1, Soriano Co. reported the following ac.pdf
5. value 10.00 polnts On May 1, Soriano Co. reported the following ac.pdf5. value 10.00 polnts On May 1, Soriano Co. reported the following ac.pdf
5. value 10.00 polnts On May 1, Soriano Co. reported the following ac.pdfmohammedfootwear
 
C programming. Answer question only in C code In the eighth part, yo.pdf
C programming. Answer question only in C code In the eighth part, yo.pdfC programming. Answer question only in C code In the eighth part, yo.pdf
C programming. Answer question only in C code In the eighth part, yo.pdfmohammedfootwear
 
Biology Lab questions1. Why can a very small amount of bacteria b.pdf
Biology Lab questions1. Why can a very small amount of bacteria b.pdfBiology Lab questions1. Why can a very small amount of bacteria b.pdf
Biology Lab questions1. Why can a very small amount of bacteria b.pdfmohammedfootwear
 
You will choose a country, other than the USA or Turkey, that you wo.pdf
You will choose a country, other than the USA or Turkey, that you wo.pdfYou will choose a country, other than the USA or Turkey, that you wo.pdf
You will choose a country, other than the USA or Turkey, that you wo.pdfmohammedfootwear
 
Why does the RNA polymerase complex in eukaryotes contain a histone .pdf
Why does the RNA polymerase complex in eukaryotes contain a histone .pdfWhy does the RNA polymerase complex in eukaryotes contain a histone .pdf
Why does the RNA polymerase complex in eukaryotes contain a histone .pdfmohammedfootwear
 
what Linux command allows you to scan the disk for partition changes.pdf
what Linux command allows you to scan the disk for partition changes.pdfwhat Linux command allows you to scan the disk for partition changes.pdf
what Linux command allows you to scan the disk for partition changes.pdfmohammedfootwear
 
What is the correct answer Chrome File Edit View History Bookmarks.pdf
What is the correct answer Chrome File Edit View History Bookmarks.pdfWhat is the correct answer Chrome File Edit View History Bookmarks.pdf
What is the correct answer Chrome File Edit View History Bookmarks.pdfmohammedfootwear
 
What is fault tolerance, and what network aspects must be monitored .pdf
What is fault tolerance, and what network aspects must be monitored .pdfWhat is fault tolerance, and what network aspects must be monitored .pdf
What is fault tolerance, and what network aspects must be monitored .pdfmohammedfootwear
 
Use the definition of big- Theta to prove that 5x^4 + 2x^3 - 1 is The.pdf
Use the definition of big- Theta to prove that 5x^4 + 2x^3 - 1 is The.pdfUse the definition of big- Theta to prove that 5x^4 + 2x^3 - 1 is The.pdf
Use the definition of big- Theta to prove that 5x^4 + 2x^3 - 1 is The.pdfmohammedfootwear
 
To what degree, if any, has America’s ascendancy on the world stage .pdf
To what degree, if any, has America’s ascendancy on the world stage .pdfTo what degree, if any, has America’s ascendancy on the world stage .pdf
To what degree, if any, has America’s ascendancy on the world stage .pdfmohammedfootwear
 
This for English class.I need help for writing 4 to 5 paragraphs a.pdf
This for English class.I need help for writing 4 to 5 paragraphs a.pdfThis for English class.I need help for writing 4 to 5 paragraphs a.pdf
This for English class.I need help for writing 4 to 5 paragraphs a.pdfmohammedfootwear
 
The debt ratio is the relationship between O A. total assets and cur.pdf
The debt ratio is the relationship between O A. total assets and cur.pdfThe debt ratio is the relationship between O A. total assets and cur.pdf
The debt ratio is the relationship between O A. total assets and cur.pdfmohammedfootwear
 

More from mohammedfootwear (20)

Getting some errors when trying to run this program, can anyone help.pdf
Getting some errors when trying to run this program, can anyone help.pdfGetting some errors when trying to run this program, can anyone help.pdf
Getting some errors when trying to run this program, can anyone help.pdf
 
Discuss what is meant by Project Scope ManagementSolutionA pr.pdf
Discuss what is meant by Project Scope ManagementSolutionA pr.pdfDiscuss what is meant by Project Scope ManagementSolutionA pr.pdf
Discuss what is meant by Project Scope ManagementSolutionA pr.pdf
 
Determine if statement is true or false. If johnny likes suzy the ri.pdf
Determine if statement is true or false. If johnny likes suzy the ri.pdfDetermine if statement is true or false. If johnny likes suzy the ri.pdf
Determine if statement is true or false. If johnny likes suzy the ri.pdf
 
Describe one safeguard that should be in place to protect the confid.pdf
Describe one safeguard that should be in place to protect the confid.pdfDescribe one safeguard that should be in place to protect the confid.pdf
Describe one safeguard that should be in place to protect the confid.pdf
 
Create a storyboard prototype of a mobile app.When creating a stor.pdf
Create a storyboard prototype of a mobile app.When creating a stor.pdfCreate a storyboard prototype of a mobile app.When creating a stor.pdf
Create a storyboard prototype of a mobile app.When creating a stor.pdf
 
Are you familiar with the term parochialism What could be happen.pdf
Are you familiar with the term parochialism What could be happen.pdfAre you familiar with the term parochialism What could be happen.pdf
Are you familiar with the term parochialism What could be happen.pdf
 
Answer the question, What market structure is the airline industry.pdf
Answer the question, What market structure is the airline industry.pdfAnswer the question, What market structure is the airline industry.pdf
Answer the question, What market structure is the airline industry.pdf
 
Adding methods to the ListBag classIn the file ListBag.py, add the.pdf
Adding methods to the ListBag classIn the file ListBag.py, add the.pdfAdding methods to the ListBag classIn the file ListBag.py, add the.pdf
Adding methods to the ListBag classIn the file ListBag.py, add the.pdf
 
5. value 10.00 polnts On May 1, Soriano Co. reported the following ac.pdf
5. value 10.00 polnts On May 1, Soriano Co. reported the following ac.pdf5. value 10.00 polnts On May 1, Soriano Co. reported the following ac.pdf
5. value 10.00 polnts On May 1, Soriano Co. reported the following ac.pdf
 
C programming. Answer question only in C code In the eighth part, yo.pdf
C programming. Answer question only in C code In the eighth part, yo.pdfC programming. Answer question only in C code In the eighth part, yo.pdf
C programming. Answer question only in C code In the eighth part, yo.pdf
 
Biology Lab questions1. Why can a very small amount of bacteria b.pdf
Biology Lab questions1. Why can a very small amount of bacteria b.pdfBiology Lab questions1. Why can a very small amount of bacteria b.pdf
Biology Lab questions1. Why can a very small amount of bacteria b.pdf
 
You will choose a country, other than the USA or Turkey, that you wo.pdf
You will choose a country, other than the USA or Turkey, that you wo.pdfYou will choose a country, other than the USA or Turkey, that you wo.pdf
You will choose a country, other than the USA or Turkey, that you wo.pdf
 
Why does the RNA polymerase complex in eukaryotes contain a histone .pdf
Why does the RNA polymerase complex in eukaryotes contain a histone .pdfWhy does the RNA polymerase complex in eukaryotes contain a histone .pdf
Why does the RNA polymerase complex in eukaryotes contain a histone .pdf
 
what Linux command allows you to scan the disk for partition changes.pdf
what Linux command allows you to scan the disk for partition changes.pdfwhat Linux command allows you to scan the disk for partition changes.pdf
what Linux command allows you to scan the disk for partition changes.pdf
 
What is the correct answer Chrome File Edit View History Bookmarks.pdf
What is the correct answer Chrome File Edit View History Bookmarks.pdfWhat is the correct answer Chrome File Edit View History Bookmarks.pdf
What is the correct answer Chrome File Edit View History Bookmarks.pdf
 
What is fault tolerance, and what network aspects must be monitored .pdf
What is fault tolerance, and what network aspects must be monitored .pdfWhat is fault tolerance, and what network aspects must be monitored .pdf
What is fault tolerance, and what network aspects must be monitored .pdf
 
Use the definition of big- Theta to prove that 5x^4 + 2x^3 - 1 is The.pdf
Use the definition of big- Theta to prove that 5x^4 + 2x^3 - 1 is The.pdfUse the definition of big- Theta to prove that 5x^4 + 2x^3 - 1 is The.pdf
Use the definition of big- Theta to prove that 5x^4 + 2x^3 - 1 is The.pdf
 
To what degree, if any, has America’s ascendancy on the world stage .pdf
To what degree, if any, has America’s ascendancy on the world stage .pdfTo what degree, if any, has America’s ascendancy on the world stage .pdf
To what degree, if any, has America’s ascendancy on the world stage .pdf
 
This for English class.I need help for writing 4 to 5 paragraphs a.pdf
This for English class.I need help for writing 4 to 5 paragraphs a.pdfThis for English class.I need help for writing 4 to 5 paragraphs a.pdf
This for English class.I need help for writing 4 to 5 paragraphs a.pdf
 
The debt ratio is the relationship between O A. total assets and cur.pdf
The debt ratio is the relationship between O A. total assets and cur.pdfThe debt ratio is the relationship between O A. total assets and cur.pdf
The debt ratio is the relationship between O A. total assets and cur.pdf
 

Recently uploaded

Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxAdelaideRefugio
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code ExamplesPeter Brusilovsky
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...Nguyen Thanh Tu Collection
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................MirzaAbrarBaig5
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnershipsexpandedwebsite
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppCeline George
 
Climbers and Creepers used in landscaping
Climbers and Creepers used in landscapingClimbers and Creepers used in landscaping
Climbers and Creepers used in landscapingDr. M. Kumaresan Hort.
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxMarlene Maheu
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文中 央社
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital ManagementMBA Assignment Experts
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project researchCaitlinCummins3
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...EduSkills OECD
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportDenish Jangid
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptxVishal Singh
 

Recently uploaded (20)

Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
Climbers and Creepers used in landscaping
Climbers and Creepers used in landscapingClimbers and Creepers used in landscaping
Climbers and Creepers used in landscaping
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptx
 

Using SQL Developer ONLY!Your assignment is to create an auditing .pdf

  • 1. Using SQL Developer ONLY! 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 table D5. Insert 3 records into the Customers table. 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. Solution /** [D1]**/ CREATE TABLE Customers1 ( Cust_id Number (8), First_name varchar2(20), Last_name varchar2(20), State varchar2 (20), Zip_code Number (9), Primary key (Cust_id) ); /***[D2]***/ Insert into Customers1 values ( 1, 'David','Smith', 'Virginia', 300050); Insert into Customers1 values ( 2, 'Vinsel', 'Nalla', 'NYK', 300051); /**[D3]**/ CREATE TABLE Customers1_history (
  • 2. history_id Number (8) , Cust_id Number (8), First_name varchar2(20), Last_name varchar2(20), State varchar2 (20), Zip_code Number (9), Primary key (history_id) ); /**** [D4]********* I have used MErge concept for this. Trigger invoke for each delete , update , insert statement on Clients Table. **************************/ create or replace TRIGGER audit_Customers1 BEFORE INSERT OR UPDATE OR DELETE ON Customers1 BEGIN MERGE INTO Customers1_history d USING Customers1 s ON (d.Cl_id = s.Cl_id) WHEN MATCHED THEN UPDATE SET d.Zip_code = s.Zip_code WHEN NOT MATCHED THEN Insert (d.History_id,d.Cl_id , d.F_name , d.L_name , d.State ,d.Zip_code ) values (s.cl_id, s.Cl_id , s.F_name , s.L_name , s.State ,s.Zip_code); END audit_Customers1; /*** [D5] ******/ Insert into Customers1 values ( 3, 'Thersa', 'john', 'Londan', 300152); Insert into Customers1 values ( 4, 'rahul', 'modi', 'delhi', 300153); Insert into Customers1 values ( 5, 'aamir', 'khan', 'Iran', 300154); /**** [D6] ******/ UPDATE Customers1 SET Zip_code = 123456
  • 3. WHERE Cust_id = 1; DELETE FROM Customers1 WHERE Cust_id = 1; /******** [D7] ********/ SELECT * FROM Customers1; SELECT * FROM Customers1_history;