DELETE ALL RECORDS FROM RELATED RECORDS

The code posted by @Kamayo Ako won't work unless there is only ONE row at each level

Not sure that's technically correct. As long as the parent table has ogrenci_id as it's PK, and as long as the child tables have ogrenci_id as the related foreign key, it could work. Not saying it's the best way of course
 
We are talking about three layers here. The method works fine for two layers. If the bottom layer contains the PK from the top level (which it should NOT). Then this method would work. But the bottom layer should contain the PK of the middle layer as its FK. If the bottom layer does not contain the top level's PK, how would you know what rows to delete?
 

Users who are viewing this thread

Back
Top Bottom