Reputation: 3740
I'm making an ERD of my database, and am stuck with a little dilemma.
Consider the tables foo
and bar
. foo
has three columns that are foreign keys, referencing to bar
's primary key. My question is: in the ERD do I represent this with just one line between those two tables, or do I use three lines?
Upvotes: 12
Views: 11870
Reputation: 4276
Extending the accepted answer I am giving an example showing when multiple "lines" (relationship) are necessary for same attribute .
Suppose, there is an e-commerce site . customers can register there & they can send gifts to other registered customers. So, there are two relations between customer and gift entity.
First relation: customer gives gift
Second relation: customer receives gift
That's why we need two lines here.You need to consider all the relations & according to that you need to draw lines. As you have three relations you need to draw three lines.
Upvotes: 8
Reputation: 43494
Use three lines. It is used one line per relationship.
PS: It is perfectly ok to have many columns reference the same column in another table. For example you can have a Person table and a Sports table and in the Person table you can have 3 columns such as FavouriteIndividualSport, FavouriteTeamSport, FavouriteExtremeSport
Upvotes: 3