Write trigger - empvac - which adds a record into a VACATION table for each EMPLOYEE who
Question:
Write trigger - empvac - which adds a record into a VACATION table for each EMPLOYEE who is INSERTed or UPDATEed into the EMPLOYEE table to ensure the difference between the HIREDATE and CURRENT DATE (SYSDATE) follows these rules:
- If employee was hired < 10 years ago - they get 3 weeks (15 days) vacation
- If employee was hired 10-19 years ago - they get 4 weeks (20 days) vacation
- If employee was hired 20-29 years ago - they get 5 weeks (25 days) vacation
- If employee was hired 30+ years ago - they get 6 weeks (30 days) vacation
If a record from the EMPLOYEE table is deleted - the associated record from the VACATION table should also be deleted.
VACATION Table Schema:
- EMPID
- HIREDATE
- VACATION DAYS
Modern Database Management
ISBN: 978-0133544619
12th edition
Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi