Reputation: 149
If there are two tables:
table1
with attributes a1, a2, a3
and table2
with attributes b1, b2, b3
. And a1
and b1
being their respective primary keys. What's the new primary key when the natural join is applied on the two tables. Do a1, b1
combine to form a composite primary key or they become two separate candidate keys
Upvotes: 0
Views: 1161
Reputation: 25534
In relational database terms the result should have keys corresponding to every key from one relation paired with every key from the other (i.e. the "natural-join" of the candidate keys, not just one key per relation). So if A1 and B1 are the only keys in your example then the only key in the natural-joined result would be (A1,B1).
However, you tagged your question with MySQL. MySQL is a SQL DBMS, not relational. MySQL doesn't support the relational model concept of key derivation. In MySQL there is no physical implementation of any key in the result of such a query.
Upvotes: 6