database ER图和EER图的区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9906017/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 08:30:06  来源:igfitidea点击:

Difference between ER diagram and EER diagram

databaseentity-relationshiperdeer-model

提问by shaki mandira

What is the difference between ERD (Entity relationship diagram) and EERD (enhanced entity relationship diagram)?

ERD(实体关系图)和EERD(增强实体关系图)有什么区别?

回答by Martin Thoma

Entity-Relationship model

实体关系模型

You have relationships (image source)

你有关系(图片来源

example for an relationship

关系的例子

and attributes (image source)

和属性(图片来源

example for an attribute

属性示例

that can also be primary keys (image source)

也可以是主键(图片来源

example for an primary key

主键的示例

Enhanced entity–relationship model

增强的实体-关系模型

You have the same as with the ER model plus

您拥有与 ER 模型相同的加

specialisation

专业化

enter image description here

在此处输入图片说明

partitioning (which are multiple specialisations)

分区(这是多个专业)

generalisation

概括

aggregation

聚合

keys are annotated differently:

键的注释不同:

enter image description here

在此处输入图片说明

回答by Srneczek

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)

我想补充一点,ER 模型是基本模型,它具有关系代数所需的一切(包括 ISA 层次结构 - inharitence 和其他我不记得的东西)。并且更抽象(因此每个框不必是数据库表,而某些框的其他方式可以超过 1 个表)

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

EER 模型更接近真实数据库的样子。所以每个盒子实际上都是桌子。

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.

我认为接受的答案也是正确的,但在我看来(没有在任何地方读过这个,我只是认为是这种方式)创建 EER 是为了帮助人们设计数据库,而不是基本的关系代数。带有 ER 的关系代数为您提供了建模数据库所需的一切,但您需要一些编译器来将 ISA 层次结构和关系转换为实际表,并使用 EER 获得您所看到的内容。我同时使用两者来设计表 - ER 更合乎逻辑,因为它使您从继承之类的东西中抽象出来,因为您只需告诉您的 ER 工具我希望它从中继承,而您不必创建 2 个表。但 EER 更好,因为你看到你得到了什么。

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

结论:ER 是基本原理,EER 是实际工作中更好的工具,抽象较少。

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

(我对关系代数的理论知识太生疏了,所以我希望我记得一切正确,如果我错了,请纠正我)

回答by Walter Mitty

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.

增强型 ER 模型添加的主要功能是专业化/泛化和联合。在这些 Gen-spec 中,最常出现在 Stackoverflow 问题的答案中。

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.

在 ER 建模中,Gen-spec 是对象建模中类-子类的对应物。举例说明:机动车辆可以是汽车或卡车。像货舱这样的特征与卡车有关,但与汽车无关。因此,有些特征适用于广义实体,但也有一些特征仅适用于其中一种特化。

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.

很多时候,人们带着一个关于 gen-spec 案例的表设计的问题来到这里。但是他们并没有意识到这一点,因为在他们开始的数据库教育中,他们从未被介绍过 gen-spec。

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.

另一种说法是,他们被教导如何建模和实现“has a”关系,而不是如何建模和实现“is a”关系。