Topic: Really newbish question about cascade delete.

Hi, this is a stupid question but i just want to be sure.
Cascade delete is only used when you have a Table that it's record is only used for 1 subject?
for example: if i have a Person and i have a table "Phone number"
I can add many phone numbers to the table, but only one phone number is associated to one person.
this means that in this case i can use cascade delete because if i delete a person i will automaticly delete it's phone number right? Not useful for tables wher eyou have:

Brand: Opel
Type: Car

In this case, table Type is used in many Brands, cascade delete is not useful in this situation.

Is this it?

Re: Really newbish question about cascade delete.

Hello.


Cascade delete is only used when you have a Table that it's record is only used for 1 subject?
for example: if i have a Person and i have a table "Phone number"
I can add many phone numbers to the table, but only one phone number is associated to one person

No, you can add many phone numbers which associated to a person, for that in a table "Phone number" you must create a foreign key to the table "Person", so for every phone number has link to person.

If you created the foreign key with cascade delete option, when you delete person, all phone number associated with this person will be deleted too.


Please check out our book, chapter: 2.3. Cascading delete and data integrity.
http://myvisualdatabase.com/download/Bo … tabase.pdf

Dmitry.