ER Diagram Online — Build Entities and Relationships
Build an ER diagram online with entities, attributes, keys, and crow’s foot relationships. Use a worked customer-order example and editable Mermaid source.
Design an ER diagram around real relationships
Use this ER diagram maker when you want to sketch a data model without writing SQL. Add entities and attributes, then connect them with a label and cardinality at each end. The generated Mermaid source lets you carry the model into documentation.
Read a customer-and-order data model
Diagram source
erDiagram
CUSTOMER ||..o{ ORDER : places
CUSTOMER {
int id PK
string name
}
ORDER {
int id PK
int customer_id FK
}How to use this tool
- Add entities with short, distinct IDs. Enter attributes one per line, such as int id PK.
- Connect two entities and choose the minimum and maximum cardinality at each end.
- Choose an identifying or non-identifying line, add a meaningful relationship label, and inspect the generated source.
Read the notation before choosing a relationship
| Symbol or marker | Meaning |
|---|---|
| || | Exactly one instance at this end of the relationship. |
| o{ | Zero or many instances at the right-hand end. The matching left-hand marker is }o. |
| |{ | One or many instances at the right-hand end. The matching left-hand marker is }|. |
| PK / FK / UK | Primary key, foreign key, and unique key markers on attributes. |
| -- / .. | Solid identifying / dashed non-identifying relationship. Choose based on the model, not decoration. |
Common questions
Should I include foreign-key attributes?
Include them for a physical schema review when the actual columns matter. A conceptual model can focus on entities and relationships without duplicating every implementation detail.
How do I model many-to-many relationships?
For a relational design, introduce a junction entity such as ENROLLMENT between STUDENT and COURSE. Give it two foreign keys and connect each parent to the junction entity.
Does the diagram create or validate my database?
No. The builder generates a diagram. Review constraints and implement the schema separately; a visually plausible relationship is not a database integrity check.