Is it possible to auto update a row in tableA when tableB is updated?
For example:
Create TableA
(
examno number not null,
hourscompleted,
Constraint examno number_PK PRIMARY KEY(examno number)
CONSTRAINT hourscompleted_FK FOREIGN KEY (hourscompleted_FK)
REFERENCES tableB (endtime- startime)
ON Update CASCADE
)
Create TableB
(
Indexno not null
starttime date,
endtime date,
Constraint INDEXNO_PK Primary Key (Indexno)
)
Secondly, could I reference it in this way tableB (endtime – startime)?
It sounds like you want Triggers. You don’t mention which database you are using but you tagged your question with
oracle.Here is some documentation about Coding Triggers in Oracle. They should allow you to do what you are asking for.
I don’t understand your second question.