NathanLedet Posted September 5, 2008 Share Posted September 5, 2008 Is it necessary to have a Foreign Key when performing Joins? From my understanding, a foreign key is the relationship between two tables. But performing Joins creates the relationship as well. Am i on the right rack? Quote Link to comment Share on other sites More sharing options...
Mchl Posted September 5, 2008 Share Posted September 5, 2008 You are. Foreign keys are more like permanent relations, while joins are ad-hoc created... That's simplifying things a bit... Quote Link to comment Share on other sites More sharing options...
NathanLedet Posted September 5, 2008 Author Share Posted September 5, 2008 thanks. So how would a foreign key come into play when performing queries? Quote Link to comment Share on other sites More sharing options...
Mchl Posted September 5, 2008 Share Posted September 5, 2008 They're useful for maintaing relational integrity. For example you can set up ON DELETE relation, so that when a parent record from table A is deleted all it's child record from table B are deleted automagically, or quite diffrently, when there are any child record in table B, then deleting parent record from table A always fails. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.