Closed loop in ERD

Solved
jong_ye Posted messages 20 Registration date   Status Member Last intervention   -  
cyril1982 Posted messages 110 Status Member -
Bonjour tout le monde, j'espère que c'est le bon endroit pour poser ma question. Je cherche à modéliser une relation qui lie une entité nommée projet, qui peut contenir une ou plusieurs communes, et de même, une commune peut être concernée par un ou plusieurs projets. Le projet peut aussi contenir un ou plusieurs quartiers, et de même, un quartier peut être concerné par un ou plusieurs projets. Une commune peut avoir un ou plusieurs quartiers, et un quartier appartient à une seule commune. Mon problème est que je n'arrive pas à modéliser la relation entre ces trois entités sans aboutir à une boucle fermée. Alors, si vous pouvez bien m'aider.

5 answers

  1. cyril1982 Posted messages 110 Status Member 12
     
    Hello,

    Often in an ERD, when the relationship between two tables is n/m, this is translated by the creation of an intermediate table.

    If we take the relationship between project and municipality, this translates into 3 tables:
    - project
    - municipality
    - project_municipality, with 2 columns id_project and id_municipality

    I hope I haven't answered off-topic.
    0
  2. jong_ye Posted messages 20 Registration date   Status Member Last intervention  
     
    but this only resolves the relationship between the project and the municipality without addressing the relationship between the project and the neighborhood.
    0
  3. cyril1982 Posted messages 110 Status Member 12
     
    For the relationship between the project and the neighborhood, an additional table must also be created: projet_quartier.

    And so on for the other relationships.
    0
  4. jong_ye Posted messages 20 Registration date   Status Member Last intervention  
     
    ok thank you Cyril
    0
  5. cyril1982 Posted messages 110 Status Member 12
     
    You're welcome, good luck :)
    0