New! Render PlantUML diagrams directly inside GitHub
with our official browser extension —
No server. No tokens. No tracking. Zero permissions but clipboard. —
Try it out and let us know what you think!
Entity Relationship Diagrams (Chen's notation)
This page is for Chen's Entity Relationship notation, which is commonly used in teaching. See also Information Engineering diagrams. Entity Relationship (ER) diagrams are used to model databases at a conceptual level by describing entities, their attributes, and the relationships between them. In addition to basic relationships, PlantUML also supports subclasses and union types. This extended notation is sometimes referred to as Enhanced Entity Relationship (EER) or Extended Entity Relationship notation. [Ref. GH-945 and GH-1718]
最小示例
垂直(默认)
横向
Entities and attributes
Entities correspond to the "things" in your model. These can have attributes that describe them and those attributes can be composite (having nested attributes).
关系
关系描述实体之间的相互关系。这些关系可以是一对一、一对多或多对多。它们可以是完全参与(强制),也可以是部分参与(可选)。全部参与用双线或粗线表示。关系也可以有属性。
结构约束
关系的卡入度也可以用范围来表示。
Identifying relationships
A weak entity does not have a key attribute that uniquely identifies each instance of that entity. Instead, it is identified by the combination of a partial key on the weak entity itself and the key of another entity, which it is related to via an identifying relationship. A weak entity must have total participation in its identifying relationship.
Aliases
Entities, attributes and relationships can be given aliases to make the diagram more readable.
Subclasses and categories
Entities can have subclasses and superclasses, much like in OOP, however a given subclass can have multiple superclasses. These are visually indicated using the subset symbol from set-theory.
复杂示例