Answer to Question #270162 in Databases | SQL | Oracle | MS Access for Tarurendra Kushwah

Question #270162

Apply a trigger on relation client (sno, fname, lname, eid, and password) on attributes fname and password after/before delete or update these columns. The trigger should insert the old or deleted values from both these columns into a new table client1.

1
Expert's answer
2021-11-25T02:32:28-0500

create table client(sno number(10), fname varchar(20), eid number(10),passwrd varchar(20));

insert into client values(001,'JAMES',101,'james101');

select * from client


----------------

create table client1(sno1 number(10), fname1 varchar(20), eid1 number(10),passwrd1 varchar(20));

--drop table client

select * from client1

---------------------

create or replace trigger client_trigg

before delete or update on client

for each row

Begin

insert into client1 values(:old.sno,:old.fname,:old.eid,:old.passwrd) ;

end;


update client set passwrd='james20' where sno=001;


delete from client where sno=001;


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS