How-to · Schema Editor

How to Design ERD Diagrams and Export SQL DDL in Schema Editor

Step-by-step tutorial: create entity tables, define PK/FK columns and data types, draw Crow's Foot cardinality relations, and export executable SQL DDL migration scripts.

Open Schema Editor Add to VS Code
Free · runs in your browser · your files are never uploaded
How to Design ERD Diagrams and Export SQL DDL in Schema Editor demonstration
Schema Editor — How to Design ERD Diagrams and Export SQL DDL in Schema Editor

TLDR

Open Schema Editor in ERD Mode, click to place entity tables, and declare columns with their data types and Primary Key (PK) or Foreign Key (FK) constraints. Drag relationship lines between tables to set standard Crow's Foot cardinality (1:1, 1:N, N:M), then click Export SQL DDL to generate clean, production-ready CREATE TABLE migration scripts for PostgreSQL, MySQL, or SQLite.


Before you start

You need a relational database model in mind (such as an e-commerce schema with users, orders, and products) and a web browser.

Schema Editor compiles visual entity graphs into SQL DDL scripts locally in your browser with zero server latency or data leakage.


Step 1 — Switch to Software / ERD Mode

In the top mode selector of Schema Editor, choose ERD Mode (or navigate to /tools/schema-editor/software/).

The left toolbar populates with entity design tools: Table Entity, Crow's Foot Connector, Note Card, and Schema Group Box.

Step 1 — Switch to Software / ERD Mode

Step 2 — Create entity tables and declare columns

Click Add Entity Table in the left toolbar (or press E).

  1. Click on the canvas to place a new table node.
  2. Double-click the header to name your table (e.g. users).
  3. Click Add Column to create attribute rows for id, email, created_at, etc.
Repeat this step to create a second table named orders with columns id, user_id, and total_amount.

Step 3 — Set Primary Keys, data types, and unique constraints

Select an entity table to view its column configuration panel on the right:

Step 4 — Connect tables with Crow's Foot relationships

Click the Connector Tool (C or the relationship icon in the toolbar).

  1. Click and drag from the users table to the orders table.
  2. A relationship line snaps between the two entities.
  3. In the right-hand Cardinality settings, select One-to-Many (1:N).
  4. The connector updates its line endings with standard Crow's Foot notation: a single cross-stroke on the users side and a three-prong crow's foot on the orders side.

Step 5 — Configure Foreign Key cascade rules

Select the relationship line to inspect its foreign key properties:

The visual line labels update to reflect the constraint relationship.

Step 6 — Export executable SQL DDL or Mermaid syntax

Click Export in the top action bar:


Pro tip: multi-dialect SQL target selection

Different SQL databases handle auto-incrementing IDs and timestamps differently (e.g. PostgreSQL SERIAL / UUID vs MySQL AUTO_INCREMENT).

When exporting SQL DDL, click the dialect dropdown in the export dialog to generate dialect-accurate syntax (such as PostgreSQL UUID PRIMARY KEY DEFAULT gen_random_uuid() or SQLite INTEGER PRIMARY KEY AUTOINCREMENT).


Next steps

Schema Editor — Draw and edit wiring diagrams, schematics, ERDs, and state machines as real SVG.