开发者

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

开发者 https://www.devze.com 2022-12-28 09:08 出处:网络
Is it correct to represent a foreign key on a conceptual data model, or should I only introduce fore开发者_StackOverflowign keys when I am doing the relational model?Experts are divided on this one.He

Is it correct to represent a foreign key on a conceptual data model, or should I only introduce fore开发者_StackOverflowign keys when I am doing the relational model?


Experts are divided on this one. Here's my opinion.

The classic ER (Entity-Relationship) model identifies relationships, but does not implement them as foreign keys. In an ER diagram, relationships appear as lines between boxes. Extra marks classify them as many-many or many-one, and as mandatory or optional. A relational model always uses foreign keys to identify and implement relationships. A relational model diagram will use lines between boxes for visual purposes, but a complete attribute list will include these foreign keys.

Another difference between ER modeling and relational modeling is that in relational modeling, a many-many relationship will be diagrammed as a box with two (or more) lines leading up to it. In ER modeling, a binary many-many relationship is modeled without a box of its own.

I always used to construct the conceptual model using ER modeling, and leave the foreign keys out. Then, at logical design time, I would switch over to the relational model and plug in the foreign keys. At this time, many-many relationships would acquire extra boxes of their own, to hold a pair (or a tuple) of foreign keys.

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

Where the ER model has served me well is in explaining the model to unsophisticated clients. Some of them have a quicker intuitive grasp of the ER model than of the relational model.


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

Object models don't rely on foreign keys; they have direct object references not based on keys.


I have seen a modified Chen ER Model (Conceptual) used with foreign keys NOT represented.

Example Modified Chen ER Model

However, in the next model, the logical model (relational schema), the foreign key would be represented.

Modified Chen ER Model Converted to Relational Schema

Additional examples and that modeling technique can be found in the following textbook:

Jukic, N., Vrbsky, S., Nestorov, S. (2014). Database Systems: Introduction to Databases and Data Warehouses.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号