Reputation: 47
Does a join between two tables always happen over a foreign key?
Upvotes: 2
Views: 51
Reputation: 791
No, you can use any column make a join. FK is preferred for greater performance, as it has an index on it.
Upvotes: 1
Reputation: 44841
In a word, no.
You can do a join on any condition, whether or not it is or uses a foreign key. In theory, it can be on no condition at all (a Cartesian join), although that's a bad idea.
Upvotes: 5