Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2007
    Posts
    28

    help on many to many relationships 3NF

    HI everybody.. need help on my database normalization design...

    we have 2 tables which has many to many relationships the first has this fields

    clients
    CLIENTID CLIENTNAME
    1 A
    2 B

    second table

    pubblications
    PUBID DESCRIPTION
    1 PUBA
    2 PUBB

    these two has many to many relationship since client can have many pubblications and pubblications have many clients

    I MADE A JUNCTION TABLE TO DEAL WITH IT...
    table name clientpubs
    the fields for the junction are
    CLIENTID AND PUBID

    MY PROBLEM IS IF it is possible to add more fields to the junction table for tyhe subscription like COUNT AND LANGUAGE or is it better to make a details table tab will INCLUDE
    CLIENTID
    PUBID
    COUNT
    LANGUAGE
    ETC

    thanks
    alex

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by alexyeth
    MY PROBLEM IS IF it is possible to add more fields to the junction table
    yes, it is
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    I do wonder why you want a count field though...
    Note that Cont is a reserved word too!
    George
    Home | Blog

  4. #4
    Join Date
    Jun 2007
    Posts
    28
    if adding more fields to a junction table is alright like count etc... which would be better to add more fields or to create a another table detailing the subscription detail with the following fields?

    CLIENTID
    PUBID
    COUNT
    LANGUAGE
    ETC

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    add more columns -- the additional table is unnecessary overhead
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  6. #6
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Just think - is this 1:1, 1:M or M:M - and bingo - there's your answer
    George
    Home | Blog

  7. #7
    Join Date
    Jun 2007
    Posts
    28
    thanks georgev i overlooked that count is a reserved word so i have to rename it..

    while for rudy so will be adding fields to the juntion table for the many to many relationship and for the primary key will it be the composite of CLIENTID AND PUBID OR WILL it be better to create a primary key column with type numeric?

  8. #8
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    composite.
    George
    Home | Blog

  9. #9
    Join Date
    Jun 2007
    Posts
    28
    thanks will try that..

Posting Permissions

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