SQL → ER 图(Mermaid)
免费在线 SQL CREATE TABLE 转 ER 关系图:自动识别显式 FOREIGN KEY 约束,并通过命名约定(如 user_id → users.id)推断隐式关系。输出 Mermaid 代码 + 在线渲染 + SVG/PNG 导出 + 一键跳 mermaid.live 编辑
SQL CREATE TABLE
Click "Render" to generate the ER diagram (first time loads Mermaid engine, ~1MB)
Mermaid code
erDiagram
users {
int id PK
string email
string name "用户名"
}
orders {
int id PK
int user_id FK "下单用户"
number total
int status
datetime created_at
}
order_items {
int id PK
int order_id
int product_id
int quantity
}
products {
int id PK
string name
number price
}
users ||--o{ orders : "cascade"
orders ||..o{ order_items : "infers"
products ||..o{ order_items : "infers"User Guide
✨ Features
• Auto-detects FOREIGN KEY constraints from CREATE TABLE • Infers relations by naming convention (column user_id + table users → relation) • Outputs standard Mermaid erDiagram code — paste into GitHub / Notion / Obsidian / etc. • On-page rendering + one-click SVG / PNG export • One-click open in mermaid.live editor • All processing local; rendering engine loaded on demand
📖 How to Use
Step 1
Paste one or more CREATE TABLE statements
Step 2
Optionally turn off 'naming-convention inference' for explicit-FK only
Step 3
Click 'Render' (first click loads Mermaid, ~1MB)
Step 4
Export as SVG / PNG, or copy Mermaid code into your docs
Like it? Rate it!