• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

m:m relationship producer_id, producer_id

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

I am developing a java based program and also I have to normalise the DB. My problem at this phase of the development is to reorganise the database structure. I need a m:m relationship between records of the same table. Producers are linked to producers. I know how to do a many to many relationship with two different entities using a third "link" table. So the question is: can I use a second table with two fields (producer_id, producer_id) just to link records of the same table. What is the best solution for this relationship?

Regards

M. Marin.
 
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you can use a join table to define a m-m relationship between the same table, the same as for two different tables. You will need to name the two foreign key columns differently of coarse.

i.e. consider a managed relationship using a join table
EMP_MANAGED
MANAGER_ID->EMP.ID
MANAGED_ID->EMP.ID
 
reply
    Bookmark Topic Watch Topic
  • New Topic