I have two tables:
First
------
id
name
Second
------
id
name
And another table connecting the first two:
Third
------
first_id
second_id
The third table is there only to resolve the M:N issue. Should it have its own ID?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If the table only contains the two foreign keys, there is no reason to have an additional key. You won’t be using it in any query.
When you join the tables using the connection table, you are making a join against one foreign key at a time, not against both foreign keys at once, so there is no use for another key in the connection table. Example:
Just make a primary key combining the two foreign keys.