Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How represent multiple similar foreign keys in ERD database diagram?

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?

like image 928
Neko Avatar asked Feb 08 '12 20:02

Neko


People also ask

How are foreign keys represented in ER diagram?

The ER model does not use foreign keys to represent relationships. It uses lines between boxes. The lines have some kind of indicator for cardinality at either end or both ends. Sometimes, a relationship will be indicated separately by a diamond.

Can a database have multiple foreign keys?

A table may have multiple foreign keys, and each foreign key can have a different parent table. Each foreign key is enforced independently by the database system. Therefore, cascading relationships between tables can be established using foreign keys.

Can 2 foreign keys reference the same table?

FOREIGN KEY constraints can reference another column in the same table, and is referred to as a self-reference. A FOREIGN KEY constraint specified at the column level can list only one reference column. This column must have the same data type as the column on which the constraint is defined.

Can a schema have multiple foreign keys?

A table can have multiple foreign keys based on the requirement.


1 Answers

Three lines, like this:

enter image description here

like image 93
Branko Dimitrijevic Avatar answered Oct 07 '22 20:10

Branko Dimitrijevic