Is it correct to represent a foreign key in a conceptual data model?

Is it correct to represent a foreign key in a conceptual data model, or should I only inject foreign keys when I make a relational model?

+2


a source to share


3 answers


Experts share this. Here is my opinion.

The classic ER (Entity-Relationship) model identifies relationships but does not implement them as foreign keys. In an ER diagram, relationships are displayed as lines between boxes. Additional labels classify them as many-many or many-one, and as required or optional. The relational model always uses foreign keys to identify and implement relationships. The relational model diagram will use the lines between boxes for visual purposes, but the complete list of attributes will include these foreign keys.

Another difference between ER modeling and relational modeling is that in relational modeling, many relationships will appear as a box with two (or more) lines leading to it. In ER modeling, the binary relation of many, many models is modeled without its own box.



I've always used a conceptual model using ER modeling and left out foreign keys. Then, during logical design, I switched to the relational model and hooked up foreign keys. At this time, many, many relationships will receive additional boxes to hold a pair (or tuple) of foreign keys.

Many experts don't follow my practice. They believe that the ER model is overkill for conceptual modeling and that it is best to start with the relational model at the conceptual level while you are still doing the requirements analysis. Then you don't have to switch modeling conventions in the middle of the stream. From a theoretical point of view, they are right.

In cases where the ER model has worked well, the model for inexperienced customers is explained. Some of them have a faster intuitive understanding of the ER model than the relational model.

+4


a source


Foreign keys are completely (and exclusively) part of the relational model.



Object models do not rely on foreign keys; they have direct references to objects that are not key-based.

0


a source


I have seen a modified Chen ER model (conceptual) used with foreign keys not represented.

An example of a modified Chen ER model

However, in the following model, the logical model (relational schema) will be represented by a foreign key.

Modified ERM model converted to relational schema

More examples and that modeling method can be found in the following tutorial:

Yukich N., Vrbsky S., Nestorov S. (2014). Database systems: An introduction to databases and data warehouses.

0


a source







All Articles