Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Should I use a Foriegn Key

Status
Not open for further replies.

JoSno

Programmer
Apr 11, 2003
45
GB
Hello all,

I have a set of tables that work on a very basic tree-like structure with one "master" table at the root.

I have to copy data from these tables into other tables of exactly the same format if a condition is met for the master record.

My question is : when I copy the master record over is it possible (maybe using foreign keys?) to yank all the records in other tables that reference said master record at the same time? Obviously this can be done in code, I'm not asking that, what I'm after is if there is a way to "make the PC do it for me" if you get what I mean.

I'm almost after a CASCADE on a copy!!

Jo
 
I don't know of any database server that does cascading copies, much less MySQL.

This would likely be because there is no way for a server to deterministically know whether you want the entire related set of records copies, or only a record from a single table of the related set.


Want the best answers? Ask the best questions: TANSTAAFL!
 
I didn't think it was possible but it's always worth checking it out just in case!

Cheers!
Jo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top