Re: deleting a row potentially referenced by many rows in another table

From: paul c <toledobythesea_at_oohay.ac>
Date: Tue, 29 Sep 2009 18:58:21 GMT
Message-ID: <hNswm.47019$PH1.14221_at_edtnps82>


TroyK wrote:
> On Sep 29, 12:36 pm, cm <cmonthe..._at_yahoo.com> wrote: ...
>> In my case, I want to delete a row in the parent table when the last
>> row in the child table referencing that (parent) row is deleted (N:1
>> from child to parent). Is there any way to do this automatically?
>> Otherwise, it seems that it would be necessary to check the Child
>> table each time a delete is performed to see if any rows still
>> reference the same parent row and then delete it (the parent row) if
>> none are found.
>>
>> Thanks,
>> CM

> 
> What is the meaning of the presence of a row in Parent at first
> insertion (i.e., before any "children" are entered) that is not the
> same meaning later on after all of its children are deleted?
> 

This isn't likely to do any good as far as CM's question is concerned, but the question points out how limited the possible "meanings" can be when most if not all dbms' fail to fully implement logical independence.   If they did support that, one could define the 'parent' and 'child' (don't ask me why tree scheme terms are creeping in here) as projections and then ask what should happen when deleting from their join. Received on Tue Sep 29 2009 - 20:58:21 CEST

Original text of this message