File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes difference between foreign key & Join Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "difference between foreign key & Join" Watch "difference between foreign key & Join" New topic
Author

difference between foreign key & Join

Bandita Patel
Greenhorn

Joined: Mar 23, 2010
Posts: 25
When to use "foreign key"? if we are getting the same result by using "Joins" then why should we use foreign key?
Satya Maheshwari
Ranch Hand

Joined: Jan 01, 2007
Posts: 368
bandita rani wrote:When to use "foreign key"? if we are getting the same result by using "Joins" then why should we use foreign key?

Foreign keys are used for joining.


Thanks and Regards
Bandita Patel
Greenhorn

Joined: Mar 23, 2010
Posts: 25
ya thats what i want to ask.. whats the difference then?
Ireneusz Kordal
Ranch Hand

Joined: Jun 21, 2008
Posts: 423
Bandita Acharya wrote:When to use "foreign key"? if we are getting the same result by using "Joins" then why should we use foreign key?


Foreign key primary role is to enforcing referential integrity between data in two tables, not joining.
Here you find the basics: http://en.wikipedia.org/wiki/Foreign_key
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: difference between foreign key & Join