ER diagrams: weak entities

ER diagrams: weak entities

puml.online

简介 / Introduction

A weak entity is one that does not have a full primary key of its own and depends on a strong (owner) entity for its identification. Its primary key is composed of a partial key plus the foreign key referencing the owning entity. This article shows how to draw ER diagrams with weak entities in both PlantUML and Mermaid.

PlantUML 版

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
@startuml
entity "Student" as Student {
+studentId : int <<PK>>
--
name : varchar
age : int
}

entity "Transcript" as Transcript <<WEAK>> {
--
courseId : int
score : numeric
}

Student ||..o{ Transcript : "owns"
@enduml

Notes:

  • <<WEAK>> marks the weak entity;
  • + prefix denotes the primary key attribute;
  • ||..o{ shows a “one owns many” relationship, where Student is the strong entity and Transcript depends on it.

Mermaid 版

1
2
3
4
5
6
7
8
9
10
11
erDiagram
Student {
int studentId PK
string name
int age
}
Transcript {
int courseId
numeric score
}
Student ||--o{ Transcript : "owns"

Notes: Mermaid’s ER diagrams do not have a <<WEAK>> annotation; weak entity semantics are expressed implicitly through the relationship. ||--o{ denotes a one-to-many “owns” relationship.

对比 / Side-by-side

Feature PlantUML Mermaid
Weak entity marker <<WEAK>> Not supported; implied by semantics
Primary key marker + prefix PK suffix
Relationship arrow `
Field separator -- Auto-separated

小结 / Wrap-up

PlantUML explicitly marks weak entities with <<WEAK>>, making the semantics clear. Mermaid expresses this implicitly via relationship arrows, offering simpler syntax but no dedicated weak-entity support. Choose based on your team’s tooling and documentation conventions.

  • Title: ER diagrams: weak entities
  • Author: puml.online
  • Created at : 2026-09-16 09:00:00
  • Updated at : 2026-09-29 01:06:38
  • Link: https://puml.online/blog/er-diagram-weak-entity-en/
  • License: This work is licensed under CC BY-NC-SA 4.0.