SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2011
    0 Post(s)
    0 Thread(s)

    Can anyone advise me on many to many relationships for my ERM?

    I have created my ERM, I was using the conolly and Begg 9 steps, and have realised that at step 7 I need to create a junction table between my many to many tables. I am unsure of why exactly and how to do this correctly, can anyone provide some help with this? Here is my ERM diagram:

    I appreciate any of your expertise advise on this as all information I could find seemed to be lacking in a full explanation.

    Many thanks.

  2. #2
    SitePoint Wizard
    Join Date
    Jul 2003
    1 Post(s)
    0 Thread(s)
    If you need a junction table / link table / bridging table , you need as a minimum a table with the primary key of both the tables in it, and you declare that both of these, which are now foreign keys of course, are a joint primary key of the table. Occasionally, you may need another attribute in the junction table as well.

    for example.
    A book can have many authors. PK of the table book is isbn.
    An author can write many books. PK of author table is idAuthor

    So you have a junction table - bookAuthor {isbn, idAuthor}



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts