File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Query" Watch "Query" New topic


amit bhadre
Ranch Hand

Joined: Jan 23, 2006
Posts: 124
How to use foreign keys as they establish relation between parent and child table and also if any updation or deletion is done in parent table the child table is also done with the changes?

Please tell the query...

Thanks advance who ever answers this question.

amit bhadre
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3753

I believe what you are interested in is 'cascading deletes'. When you create the table reference you add the keywords "ON DELETE CASCADE" without the quotes.

The syntax may very from db to db so you might have to check google for except specifications.

[OCA 8 Book] [Blog]
I agree. Here's the link:
subject: Query
It's not a secret anymore!