Suppose we have two tables:
Employees
(id (pk), salary)Bonus
(id (fk), increase, total)
bonus.id
is a FK that references the PK 'employees.id'.
I want total
to be equal to employees.salary + bonus.increase
by default. I also want the value to be assigned to total whenever salary or bonus are updated.
What sql or pl/sql statements are capable of doing this?
Note: I'm an absolute noob.