Entity Relationship Diagram
Entity Relationship Diagram
An entity relationship diagram describes a data model: the entities (things a
system stores) and the relationships between them, with cardinalities on each
end. kymo's editor reads the
Mermaid
erDiagram syntax.
This page works like a quickstart: as you scroll, the pane on the right shows the source and the preview for the section you're reading. Copy grabs the source; ▶ Open in editor loads it into editor.kymo.studio (pick mermaid in the diagram-type dropdown when starting from scratch).
The example on the right is the classic order model: a statement is
ENTITY <cardinality>--<cardinality> ENTITY : label, and the label names the
relationship from the first entity's point of view.
erDiagram
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ LINE-ITEM : contains
CUSTOMER }|..|{ DELIVERY-ADDRESS : uses
Cardinality
Each end of the relationship operator carries a two-character cardinality marker, read outward from the dashes:
The dashes in the middle encode identification: -- is an identifying
relationship (the child cannot exist without the parent — drawn solid), ..
is non-identifying (drawn dashed).
erDiagram
CAR ||--o{ NAMED-DRIVER : allows
PERSON }o..o| NAMED-DRIVER : is
HOUSE |o--|| ADDRESS : has
Attributes
A { … } block after an entity lists its attributes as type name pairs.
A trailing key keyword marks PK (primary key), FK (foreign key), or UK
(unique key) — combine them with commas (PK, FK) — and a trailing quoted
string adds a comment.
erDiagram
CUSTOMER ||--o{ ORDER : places
CUSTOMER {
string name
string custNumber PK
string sector
}
ORDER {
int orderNumber PK
string deliveryAddress FK "delivered to"
}
Status. ER diagram previews on this page and in the editor use the Mermaid renderer; importing ER diagrams into kymo's own pipeline (native SVG/PNG/PDF rendering) is on the roadmap.
See also
- Class Diagram — for modelling behaviourful objects rather than stored data.
- Best Practices — layout and readability guidance.