Multiple FK columns pointing to the same parent table is a good idea?

For those of you who are living and developing a database design, have you ever found good reason to have multiple FKs in a table that all point to the same parent table?

Recently, we had to deal with a situation where we had a table containing six columns, which were all FK columns in the same parent table. We are debating whether this indicates poor design on our part or whether it is more common than we think.

Many thanks.

+3
source share
8 answers

. , , , , . , , - -, user_to user_from user_id users.

6- , , - , , , .

+6

(.. ). - , 6 .

, : Item1, Item2, Item3, ( ), , , .

+4

, , :

, CreatedBy, LastModifiedBy, AcceptedBy, ProposedBy,

+3

, PK , . ( ), , , , .

+1

, 6 , ... , . " ", ?

0

FK .

, , ,

, :

, stuffID. stuffID1, stuffID2 . 3 FK.

0

Having a database of an online store, there should be one table containing addresses and one table containing orders - now so that there are two tables fk in the address table, one of which contains delivery, and the other containing the key of the billing address.

0
source

Personality table {personID otherpersonattributes ...} InterPersonRelationships table {personID1 personID2 relationshiptype}

It is very natural to have two different FKs in the same parent table in this situation.

0
source

Source: https://habr.com/ru/post/1745499/


All Articles