Re: Help to design relations between some 5 tables with possible many-to-many relations

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
Cc: pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Help to design relations between some 5 tables with possible many-to-many relations
Date: 2021-06-21 19:25:24
Message-ID: CAKFQuwbe9iokBFSM+qt0-Eh1GHDp=S7+jw=bBJUoTuJMWBkW7Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, Jun 21, 2021 at 12:07 PM JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
wrote:

> Hi,
>
> I have the following tables: *reports*, *standards*, *elements*, *tables*,
> *items*.
> * One *report* has many *standards*.
> * One *standard* has many *elements*.
> * One *element* has many *tables*.
> * One *table* has many *items*.
> [...]
> I see that many-to-many relations exist between all of the tables but I am
> not able to clearly visualize.
>

From my perspective the fundamental decision you need to make is whether to
indeed deal with many-to-many relationships or just deal with one-to-many
relationships. In the later case you have 5 entities and 4 relationships
and thus you will have 9 tables. If you can force one-to-many
relationships then you only need 5 tables, with the four "right side"
tables having a FK to the corresponding "left side" table.

Personally, I would go with one-to-many relationships and just "clone"
anything that is going to be the same from one year to the next.

David J.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Dean Gibson (DB Administrator) 2021-06-21 21:03:06 Re: Help to design relations between some 5 tables with possible many-to-many relations
Previous Message JORGE MALDONADO 2021-06-21 19:07:17 Help to design relations between some 5 tables with possible many-to-many relations