This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JDBC and the fly likes Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Query" Watch "Query" New topic
Author

Query

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.


regards
amit bhadre
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    5

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.


My Blog: Down Home Country Coding with Scott Selikoff
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Query