Question: Solve the question in two parts, first using standard SQL and then solve using Oracle. Please answer only if you understand databases well and can
Solve the question in two parts, first using standard SQL and then solve using Oracle. Please answer only if you understand databases well and can answer correctly.
Suppose you are given a relation emp(empid, dept, salary) and wish to maintain a materialized view
deptsalary(dept, totalsalary) which stores the total salary for all employees of each department. Suppose the system does not support materialized views but supports triggers. Write an SQL and a Oracle trigger on insert on emp to keep the relation deptsalary up to date. Do not worry about deletes or updates. You can assume that there is already a tuple for each department in deptsalary so you do not need to worry about new deparments. (Note: if you solve this question using Oracle, do not create a view for deptsalary, just create a table for it. You will use keywords: create trigger, create or replace trigger, insert on .....etc)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
