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?
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.
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.
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.
A table can have multiple foreign keys based on the requirement.
Three lines, like this:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With