How to represent several similar foreign keys in an ERD database diagram?

I am doing an ERD of my database and I am stuck with a little dilemma.

Consider the tables foo and bar . foo has three columns, which are foreign keys, referring to the primary key bar . My question is: in ERD, am I representing this with only one row between these two tables, or am I using three rows?

+4
source share
4 answers

Three lines, for example:

enter image description here

+5
source

Use three lines. One line is used for each link.

PS: It’s normal that many columns refer to the same column in another table. For example, you can have a Person table and a Sports table, and in a Person table you can have 3 columns, such as FavoriteIndividualSport, FavoriteTeamSport, FavoriteExtremeSport

+3
source

Extension of the accepted answer. I gave an example showing when several "lines" (relationships) are needed for the same attribute.
Suppose there is an e-commerce site. customers can register there, and they can send gifts to other registered customers. Thus, there are two relationships between the client and the entity.

enter image description here

The first attitude: the client gives a gift
The second attitude: the customer receives a gift
That is why we need two lines here. You need to consider all the relationships and in accordance with this you need to draw lines. Since you have three relationships, you need to draw three lines.

+1
source

If you have three columns in a table, all refer to one column in another table ... it looks like there are some problems with the design of the table!

-one
source

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


All Articles