[V4RB] ? about cascade deletion and many to many relationship

Yennie at aol.com Yennie at aol.com
Thu Feb 6 17:46:16 CST 2003


In case it helps anyone, I can give an example from my database: (note: I 
draw my arrows FROM the ObjectPtr field to the table it points to)

1) I have tables "Courses", "Units" and "CUnits" where CUnits has pointers to 
Courses and to Units. Both ObjectPtr fields are set to "Cascade".

When I delete a course, all of the related links to units in CUnits are also 
deleted, but the units are not.

Course1 <- CUnit1 -> Unit1
Course1 <- CUnit2 -> Unit2
Course2 <- CUnit3 -> Unit1

So for example, if I delete "Course1" then I will also be deleting "CUnit1" 
and "CUnit2".   Notice how you cannot follow the arrows from one end of this 
diagram to the other: they flow in opposite directions.

etc.

2) I have tables "Subjects", "Categories", "Topics". Categories have a field 
"SUBID" which points "up" to Subjects. Topics has a field "CATID" which 
points up to Categories. Thus it looks like an ordinary hierarchy:

Subject1
     Category1
         Topic1
         Topic2
     Category2
         Topic3
     Category3
         Topic4

OR...   Subject <- Category <- Topic

When I delete a Subject, my database also deletes all of the categories and 
topics underneath, because they are linked by 1:M ObjectPtr set to "cascade". 
Thus deleting 'Subject1' here deletes ALL of the records in the hierarchy.

HTH.



> In your case you have tables:
> 
>         M  ->  1   <-  M
> 
> But above paragrah say about case:
> 
>         1 <- M <- M
> 



More information about the Valentina mailing list