Search code examples
oracleoracle-sqldeveloperoracle-sql-data-modeler

Tables showing up with two: 'one to many' relationships in oracle sql developer


I'm looking through our data and there's a handful of tables in our oracle database that show up with two one to many relationships: https://i.sstatic.net/icGcV.png

I'm not sure why this would be happening, and is it something I should look into getting changed or fixed?

(I did not create this database, I am only trying to understand it!)


Solution

  • Too long for a comment, let's see a very simple example:

    CREATE TABLE persons
    (
        id      NUMBER PRIMARY KEY,
        name    VARCHAR2(10)
    )
    /    
    CREATE TABLE marriages
    (
        wife       NUMBER     REFERENCES persons(id),
        husband    NUMBER     REFERENCES persons(id)
    )
    /    
    CREATE TABLE dogs
    (
        id       NUMBER PRIMARY KEY,
        name     VARCHAR2(10),
        owner    NUMBER     REFERENCES persons(id)
    )
    /
    

    Here you have one table with two different FKs to the same table. At the same time you have another table with a single FK to the same table. So, it's not a problem to fix, but a part of DB design to understand; your DB can be well or bad designed, but the existence of such situations does not say anything about that.