Please write this in SQL. Consider the following relation schemas: Department(dn
ID: 3766794 • Letter: P
Question
Please write this in SQL.
Consider the following relation schemas: Department(dnumber. dname. employee count). PK: dnumber. Employee (eid, fname, lname. salary, dno), PK: eid, FK: dno refs Department. Write triggers in PL SQL that satisfy the following requirements: The employee count column in the Department table records the current number of employees in each department You should guarantee that, whenever an employee record is inserted, deleted or updated in the Employee table, the employee count attribute always has the correct value for the affected department(s) in the Department table. Also, no department in the organization should have an average salary lower than 10,000. When the insertion, deletion or update of an employee record causes the average salary of a department to be lower than 10,000, the corresponding operation should be cancelled. You may create additional tables or views if needed.Explanation / Answer
CREATE TRIGGER TOTAL_EMPLOYEE AFTER UPDATE/INSERT/DELETE OF dno ON Employee FOR EACH ROW
BEGIN
FROM employees
GROUP BY department;
END;