What is a SQL Table Relationship Viewer?
It is a tool that reads SQL DDL (CREATE TABLE scripts) and draws an Entity-Relationship Diagram (ERD) showing tables, columns, primary keys, foreign keys, and how tables connect.
Paste CREATE TABLE DDL and explore an interactive ER diagram with foreign keys, validation, statistics, and local exports.
Visual designer
Diagram
SQL & Export
Production schemas grow fast. Reading hundreds of CREATE TABLE statements is slow and error-prone. An ER diagram shows parent/child links, junction tables, and missing keys at a glance — essential for migrations, onboarding, legacy analysis, and query design.
Load the built-in sample to see a classic one-to-many relationship: orders.customer_id references users.user_id. Use this pattern to learn how foreign keys appear on the canvas and in the relationship inspector.
It is a tool that reads SQL DDL (CREATE TABLE scripts) and draws an Entity-Relationship Diagram (ERD) showing tables, columns, primary keys, foreign keys, and how tables connect.
An Entity-Relationship Diagram visualizes database tables as entities and foreign keys as relationships. It helps you understand schema structure without reading long SQL scripts.
No. It never runs SQL against a database. It only parses DDL text statically in your browser.
No. Parsing and diagram generation happen locally in your browser. Your schema is not transmitted.
PostgreSQL, MySQL, MariaDB, SQLite, and SQL Server CREATE TABLE patterns are supported in v1. Other dialects may parse partially. Select your dialect for best results.
Yes. Paste or upload a .sql file containing CREATE TABLE statements. INSERT and DML statements are ignored during schema extraction.
Yes. Declared FOREIGN KEY constraints and inline REFERENCES clauses are parsed into relationship edges on the diagram.
Yes, optionally. Enable "Infer missing FKs" to suggest links from naming conventions like customer_id → customers. Inferred edges are shown dashed and should be reviewed.
Yes. Export Mermaid erDiagram, Markdown documentation, JSON schema graph, DBML, DDL, migration SQL (with baseline), matrix CSV, or PNG snapshot.
Yes. Composite PRIMARY KEY constraints and multi-column foreign keys are parsed when declared in standard DDL syntax.
Yes. Set a diff baseline from your current schema, then edit SQL or use Design mode. Changed tables and relationships are highlighted on the canvas; open the Schema diff tab for details and export migration SQL.
Small and medium schemas work instantly. Inputs above ~300 KB use a Web Worker. Very large schemas above ~5 MB or ~150+ tables may slow rendering — filter or split scripts when possible.
Modern Chromium, Firefox, Safari, and Edge with Web Worker and localStorage support.
Yes, after the page loads. Parsing and visualization are client-side.
Yes. No database connection and no server upload. Processing stays on your device.
One-to-one, one-to-many, many-to-many (junction tables), and self-referencing relationships based on keys and table shape.
Yes. Select a relationship edge to view constraint metadata including ON DELETE / ON UPDATE when present in DDL.
Yes. It reports missing primary keys, broken foreign key references, duplicate columns, isolated tables, and circular dependency warnings.
Import order is a suggested CREATE TABLE sequence based on foreign key dependencies — parent tables before child tables.
Drop order reverses import order so child tables are removed before parent tables, respecting typical FK dependencies.
Yes. Use the search box to highlight matching tables and filter the diagram view.
Yes. ALTER TABLE ADD CONSTRAINT FOREIGN KEY is parsed. Design mode edits regenerate CREATE TABLE DDL; use Migration SQL export (with a baseline) for ALTER-style migration scripts.
Yes. Enable Design mode to add/edit/delete tables and relationships, drag table handles to connect FKs, and sync changes back to SQL DDL automatically. Undo/redo with Ctrl+Z / Ctrl+Shift+Z.
Yes. The canvas supports pan, zoom, fit-to-view, and draggable table nodes with automatic layout.
The Validator checks SQL syntax. This tool extracts schema structure and draws relationships from valid CREATE TABLE DDL.
This tool is integrated into DevToolsBuilder's local-first SQL suite with handoffs to validator, formatter, compare, and Learn SQL — no account required.
Yes. Load the Users & Orders sample and cross-link to Learn SQL lessons on joins, keys, and relational modeling.
No. Parsing and layout are deterministic. No LLM calls are made.
Yes. Export or copy Mermaid erDiagram syntax for README files, wikis, and Mermaid-compatible renderers.
Ensure your script contains CREATE TABLE statements with supported syntax. Open the SQL Validator from the toolbar to fix syntax issues first.
Yes. No account, usage limit, or per-diagram charge.