Difference between ER diagram and EER diagram

一笑奈何 提交于 2019-12-02 17:10:16
Martin Thoma

Entity-Relationship model

You have relationships (image source)

and attributes (image source)

that can also be primary keys (image source)

Enhanced entity–relationship model

You have the same as with the ER model plus

specialisation

partitioning (which are multiple specialisations)

generalisation

aggregation

keys are annotated differently:

I would add that ER model is basic model which has all you need for relational algebra as it is (including ISA hierarchy - inharitence nad other stuff I don't remember). And is more abstract (so every box doesn't have to be database table and the other way around some boxes can be more then 1 table)

EER model is closer to what real database look like. So every box is actually table.

I assume the accepted answer is right too, but in my opinion (havent read this anywhere I just think it is this way) EER was created to help people design databases even more then the basic relational algebra. Relational algebra with ER gives u everything you need to model database but you need some compiler which will translate ISA hierarchies and relations into actual tables and with EER your getting what you see. I was using both to design tables - ER is more logical, because it abstracts you from stuff like inheritance since you just tell your ER tool I want this to inherit from that and you dont have to create 2 tables. But EER is better because you see what you get.

Conclusion: ER is basic principle, EER is little bit better tool for actual work with less abstraction.

(My teoretical knowladge of relational algebra is too rusty, so I hope I remember everything right, correct me if I am wrong)

The primary features added by the Enhanced ER Model are specialization/generalization and unions. Of these Gen-spec is the one that most often comes up in answers to Stackoverflow questions.

Gen-spec is the counterpart, in ER modeling, of class-subclass in object modeling. An example to illustrate: a motor vehicle could be an auto or a truck. A feature like cargo space pertains to a truck but not to an auto. So there are features that apply to the generalized entity, but the are also features that apply to only one of the specializations.

Very often, people come in here with a question about table design for a case of gen-spec. But they don't recognize it as such, because they were never introduced to gen-spec in their beginning education about databases.

Another way of saying this is that they were taught how to model and implement "has a" relationships, but not how to model and implement "is a" relationships.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!