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]
Minimal Example
Vertical (by default)
Horizontal
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).
Relationships
Relationships describe how entities are related to each other. These can be one-to-one, one-to-many, or many-to-many. They can have total participation (mandatory) or partial participation (optional). Total participation is indicated using a double or thicker line. Relationships can also have attributes.
Structural constraints
The cardinality of relationships can also be expressed as a range.
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.
Complex Example