RobBroekhuis
Technical User
A rather basic question from a relational database newbie:
Say I have three tables:
Members (key: m_id)
Groups (key: g_id)
Membership
Membership only exists to establish a many-to-many relationship between Members and Groups (each member may be part of several groups). The only fields I really need in Membership are foreign keys m_id and g_id. According to books I've read, I should have a primary key in the membership table, but I don't see the point. Even if I had a key, say ms_id, I would never know it, would always have to query for it. The table is almost always used in join queries (only time this is not the case is when establishing or removing membership).
Can someone explain why it's beneficial to have a key in this situation?
Rob
Say I have three tables:
Members (key: m_id)
Groups (key: g_id)
Membership
Membership only exists to establish a many-to-many relationship between Members and Groups (each member may be part of several groups). The only fields I really need in Membership are foreign keys m_id and g_id. According to books I've read, I should have a primary key in the membership table, but I don't see the point. Even if I had a key, say ms_id, I would never know it, would always have to query for it. The table is almost always used in join queries (only time this is not the case is when establishing or removing membership).
Can someone explain why it's beneficial to have a key in this situation?
Rob