Last updated
Database Schema Visualization
A database schema diagram (Entity-Relationship diagram or ERD) shows tables, their columns, data types, and the relationships between them (foreign keys). Schema visualization helps developers understand complex databases, plan migrations, and onboard new team members. Tools like dbdiagram.io, DrawSQL, and Mermaid can generate ERDs from SQL or a simple DSL.
Mermaid ER Diagram Syntax
erDiagram
USERS {
int id PK
string email UK
string name
datetime created_at
}
POSTS {
int id PK
int user_id FK
string title
text content
datetime published_at
}
COMMENTS {
int id PK
int post_id FK
int user_id FK
text body
datetime created_at
}
USERS ||--o{ POSTS : "writes"
POSTS ||--o{ COMMENTS : "has"
USERS ||--o{ COMMENTS : "writes"
Relationship Notation
| Symbol | Meaning |
|---|---|
|| | Exactly one |
o| | Zero or one |
|| | One or more |
o{ | Zero or more |