1.Components of the ER Diagram
a.entities
实体是客观存在并且可以相互区分的任何事物
A real-world thing either living or non-living that is easily recognizable and nonrecognizable. It is anything in the enterprise that is to be represented in our database. It may be a physical thing or simply a fact about the enterprise or an event that happens in the real world.
An entity can be place, person, object, event or a concept, which stores data in the database. The characteristics of entities are must have an attribute, and a unique key. Every entity is made up of some 'attributes' which represent that entity.
a.1 entity set
实体集是具有相同属性的实体的集合
实体的值是该实体诸属性值的列表
实体集的值是该实体集中所有实体值的集合
其值可以唯一确定实体集中每个实体的属性集称为该实体集的超码
那些其真子集都不是超码的极小超码称为候选码
主码是数据库设计者选中的,是用来区分同一实体集中不同实体的候选码
An entity set is a group of similar kind of entities. It may contain entities with attribute sharing similar values. Entities are represented by their properties, which also called attributes. All attributes have their separate values. For example, a student entity may have a name, age, class, as attributes.
a.2 弱实体集和强实体集
强弱实体集b.Attributes
属性是实体所代表事物具有的某种特性
It is a single-valued property of either an entity-type or a relationship-type.
属性属性大部分都是简单的不能划分成更小的结构、单值的只能取单个值、基本的不能由其他属性推导出
复合属性与简单属性对应是可以划分成更小部分的属性
多值属性对应单值属性是特定的实体在该属性上可以取多个值的属性
派生属性对应基本属性的值可以从其他相关属性或实体计算得到,因此又称为计算属性
c.Relationships
联系是多个实体之间的相互关系
联系集是相同的类型联系的集合
实体在联系中的作用称为实体的角色
Relationship is nothing but an association among two or more entities
联系的类型又称为联系的函数性或映射函数
一对一联系E2与E1中的每个实体最多与另一个实体集中的一个相互关联
一对多联系(1:n联系)
多对一联系(n:1联系)
多对多联系(m:n联系)
2.er图的表达
2.1 ER- Diagram Notations
Rectangles: This symbol represent entity types
Ellipses : Symbol represent attributes
Diamonds: This symbol represents relationship types
Lines: It links attributes to entity types and entity types with other relationship types
Primary key: attributes are underlined
Double Ellipses: Represent multi-valued attributes
2.2 关系的图标
- one to one 1对1
One entity from entity set X can be associated with at most one entity of entity set Y and vice versa.
- one to many 1对多
One entity from entity set X can be associated with multiple entities of entity set Y, but an entity from entity set Y can be associated with at least one entity.
-
many to one 多对1
More than one entity from entity set X can be associated with at most one entity of entity set Y. However, an entity from entity set Y may or may not be associated with more than one entity from entity set X.
多对1 -
many to many 多对多
One entity from X can be associated with more than one entity from Y and vice versa.
2.3 Cardinality 多种不同写法
2.3.1 Information Engineering Style
image.png2.3.2 chen style
chen2.3.3 bachman style 用的比较少
bachman2.3.4 martin style
martin3.er图转等价关系
image.png多对1的关系,把出版社名放在图书(多的)里面
多对多的关系,重新建立一个关系模式,把各自的主键拿来当作主键?
reference:
https://blog.csdn.net/limuzi13/article/details/50390810
https://www.jianshu.com/p/9701c8ad5a7b
https://www.smartdraw.com/entity-relationship-diagram/
网友评论