aliases:
- ER Diagram
see-also:
- "[[ER Diagrams in MermaidJS]]"| Symbol / Keyword | Description | Example |
|---|---|---|
| -- | Simple Line: Represents a connection without specified cardinality. | ENTITY_A -- ENTITY_B |
| ||--|| | One-to-One: Both entities are mandatory. | PERSON ||--|| PASSPORT |
| ||--o{ | One-to-Many: One mandatory entity on the left, zero or many on the right. | CUSTOMER ||--o{ ORDER |
| }o--|| | Many-to-One: Zero or many entities on the left, one mandatory on the right. | BOOK }o--|| AUTHOR |
| |o--o{ | Zero-or-One to Many: Zero or one entity on the left, zero or many on the right. | DEPARTMENT |o--o{ EMPLOYEE |
| }o--o{ | Many-to-Many: Zero or many entities on both sides. | STUDENT }o--o{ COURSE |
| PK | Primary Key: Indicates a primary key attribute within an entity definition. | id PK (used like: CUSTOMER { string id PK }) |
| FK | Foreign Key: Indicates a foreign key attribute within an entity definition. | customer_id FK (used like: ORDER { string customer_id FK }) |
| : label | Relationship Label: Adds descriptive text to the relationship line. | ORDER ||--o{ LINE_ITEM : contains (The : contains is the label) |
Example Mermaid Diagram Snippet (for context):