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

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Help to design relations between some 5 tables with possible many-to-many relations
Дата
Msg-id CAKFQuwbe9iokBFSM+qt0-Eh1GHDp=S7+jw=bBJUoTuJMWBkW7Q@mail.gmail.com
обсуждение исходный текст
Ответ на Help to design relations between some 5 tables with possible many-to-many relations  (JORGE MALDONADO <jorgemal1960@gmail.com>)
Список pgsql-sql
On Mon, Jun 21, 2021 at 12:07 PM JORGE MALDONADO <jorgemal1960@gmail.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.

В списке pgsql-sql по дате отправления:

Предыдущее
От: JORGE MALDONADO
Дата:
Сообщение: Help to design relations between some 5 tables with possible many-to-many relations
Следующее
От: "Dean Gibson (DB Administrator)"
Дата:
Сообщение: Re: Help to design relations between some 5 tables with possible many-to-many relations