SQL CREATE TABLE
CREATE TABLE users ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, email VARCHAR(255) NOT NULL UNIQUE, name VARCHAR(100) COMMENT '用户名', PRIMARY KEY (id) ); CREATE TABLE orders ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, user_id BIGINT UNSIGNED NOT NULL COMMENT '下单用户', total DECIMAL(10,2) DEFAULT 0, status TINYINT(1) DEFAULT 1, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), CONSTRAINT fk_user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE ); CREATE TABLE order_items ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, order_id BIGINT UNSIGNED NOT NULL, product_id BIGINT UNSIGNED NOT NULL, quantity INT DEFAULT 1, PRIMARY KEY (id) ); CREATE TABLE products ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, price DECIMAL(10,2) NOT NULL, PRIMARY KEY (id) );
Mermaid code
(pending)
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!

Feedback List