ER diagrams: cardinality and identifying relations
简介 / Introduction
ER diagrams (Entity-Relationship diagrams) describe entities, attributes, and their connections in a data model. Cardinality expresses the numerical constraint between two entities, while an Identifying Relationship distinguishes strong from weak entities. This post shows both PlantUML and Mermaid syntax with a side-by-side comparison.
PlantUML 版
PlantUML uses symbol pairs like ||--o{ to express cardinality and identifying relations:
1 | @startuml |
Mermaid 版
Mermaid uses single-character combinations for cardinality, with double bars || marking identifying relations:
1 | erDiagram |
对比 / Side-by-side
| Feature | PlantUML | Mermaid |
|---|---|---|
| Cardinality symbols | ||--o{ etc. |
| + o combos |
| Identifying relation | Double line || |
Double line || |
| Strong/weak entity | Distinguishes by line style | Distinguishes by relationship type |
| Relationship label | : label after symbols |
Written between entities |
PlantUML’s symbol system is more visual — line style directly conveys cardinality and entity strength. Mermaid’s compact letter combos are quicker to learn and easier to embed in Markdown.
小结 / Wrap-up
ER diagrams are a core tool in database design. Mastering cardinality and identifying relation syntax in both PlantUML and Mermaid lets you switch tools fluidly across documentation contexts. Pick PlantUML for richer visual expressiveness, or Mermaid for fast inline diagrams in Markdown.
- Title: ER diagrams: cardinality and identifying relations
- Author: puml.online
- Created at : 2026-09-15 09:00:00
- Updated at : 2026-09-29 01:06:38
- Link: https://puml.online/blog/er-diagram-cardinality-en/
- License: This work is licensed under CC BY-NC-SA 4.0.