Question: Problem 1 To create a trigger: when some records are deleted from the emp table, the deleted records are written into an employee history table(create
Problem 1 To create a trigger: when some records are deleted from the emp table, the deleted records are written into an employee history table(create the history table firstly). CREATE TABLE emp_his AS SELECTFROM EMP WHERE 1-2; CREATE OR REPLACE TRIGGER tr del emp after DELETE Specifies the trigger time to trigger the delete operation ON scott.emp FOR EACH ROW Description created is a row level trigger BEGIN insert the modified data to the log record table del emp, for supervision INSERT INTO emp his (deptno, empno, ename , job ,mgr , sal, comm hiredate) VALUES old.deptno, old.empno, old.ename, old.job, old.mgr, old.sal, old.comm, old.hiredate) END Problem 2 Design a row trigger: when the value of deptno column in the DEPT table is updated, the corresponding deptno value in the EMP table is also modified. Problem 3 Design a row trigger for updating of emp table, when modifying the salary update the sum of the corresponding department(add a sumsalary coulmn to dept table firstly). Problem 4 To create a trigger: when some records are deleted from the emp table, the summary account of employees are written into an dept table(add a persons coulmn to dept table firstly)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
