I am trying to figure out how cascade delete works. I know the general concept but not the specifics of it.
I have 3 tables (a)||---|<(B)>o---||(C)
Table A: Aid Tag
Table B: Aid (f) Cid (F)
Table C: Cid Other
A row in table A must have at least one reference to table c or else it should be deleted. A row in table A is made only when Table C tries creating a tag that does not exist. If table C removes that tag and no other rows from table C reference that tag then the tag should be removed. If another row from table C references that tag then the tag should not be deleted.
If I set Table B [Aid] to delete cascade would it: 1) If the tag from table A is deleted automatically remove any links in table B 2) I delete a row from table B belonging to tagz. There is another row in table B that references tagz. Would that deletion cause tagz to be deleted as well or would tagz remain so long as any row references it?
If you have set up table B to delete cascade on the foreign key to table A then if a tag get's deleted the corresponding records in Table B will be deleted. Table B deletions will not affect table A since table A does not have any references or foreign keys into table B.