Experts,
Today i went through an interview ,there was a question to me. There are 3 tables table A table B table C. So table A is a parent table for B and table d C is a child table for B.
How should I delete data from table A and what could be issues.
I answered - If I have to delete Data from table A , you cannot delete directly from table A as there is dependency between table Band C which will lead to inconsistency. So we need to be use on cascade to delete the data from table A. So once you use an cascade then there will be a consistency across all stables. Now the interviewer has asking me are there any different approaches other than on Cascade? In order to delete data from table A.
I also answered to delete the data from bottomup approach. So first identify the number of dependent records in table C, then delete them and after that identify the number of dependent records in table B and delete them and then finally delete from table A.
Interviewe was not satisfied, May i know do we have other approach ?
Thanks,
S