SQL Schema Extractor

Paste a SQL dump and pull the schema out of its CREATE TABLE / ALTER TABLE statements — columns, types, primary keys, foreign keys, unique, checks, and indexes — as a JSON model or a Markdown doc. Comments and INSERT rows are ignored, and nothing is executed.

Try:
Extracted schema

About this tool

SQL Schema Extractor turns raw DDL from a dump into a clean schema model without connecting to a database or executing anything. Paste CREATE TABLE, ALTER TABLE, and CREATE INDEX statements and it extracts tables, columns, types, nullability, defaults, primary keys, foreign keys, unique constraints, checks, and indexes.

Use JSON when you want structured data for automation, audits, migrations, or documentation pipelines. Use Markdown when you want a readable schema reference with one section per table. Comments and data rows are ignored, so mixed dumps that include INSERT statements still produce a schema-only result.

The parser is intentionally lenient and local-first. It normalizes common identifier quoting styles from MySQL, PostgreSQL, SQLite, SQL Server, and generic SQL, then folds supported ALTER TABLE ... ADD statements onto their target table by default so the output represents the final schema.

FAQ

Does this execute my SQL or connect to a database?

No. The tool is a text parser that runs locally in the browser/CLI. It reads DDL text and emits a model; it does not connect to a database, run queries, create tables, or inspect live data.

Which SQL statements are parsed?

It focuses on schema-defining statements: CREATE TABLE, supported ALTER TABLE ... ADD forms, and CREATE INDEX / CREATE UNIQUE INDEX. Non-DDL statements such as INSERT, UPDATE, SELECT, DROP, and comments are skipped so dump files remain usable.

What output format should I choose?

Choose json for automation: it includes table counts, columns, constraints, foreign keys, checks, and indexes in a structured model. Choose markdown when you want a human-readable schema document with table sections and constraint lists.

Does it support every SQL dialect feature?

No. It covers common DDL patterns across MySQL, PostgreSQL, SQLite, SQL Server, and generic SQL, including quoted identifiers and common column/constraint syntax. It does not try to be a full SQL engine, parse stored procedures, infer relationships without explicit foreign keys, or render ER diagrams.

Developer & Automation Access

Run it from the terminal

Same engine as this page, headless — via the gizza CLI:

gizza tool sql-schema-extractor "CREATE TABLE users (
  id INT PRIMARY KEY AUTO_INCREMENT,
  email VARCHAR(255) NOT NULL UNIQUE,
  age INT DEFAULT 0 CHECK (age >= 0)
);"

New to the CLI? Get gizza →

Open it by URL

Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:

https://gizza.ai/tools/sql-schema-extractor/?sql=CREATE%20TABLE%20users%20%28%0A%20%20id%20INT%20PRIMARY%20KEY%20AUTO_INCREMENT%2C%0A%20%20email%20VARCHAR%28255%29%20NOT%20NULL%20UNIQUE%2C%0A%20%20age%20INT%20DEFAULT%200%20CHECK%20%28age%20%3E%3D%200%29%0A%29%3B&output=json&dialect=auto&apply_alter=true&include_indexes=true

Machine-readable descriptor: tool.json — title + parameters JSON Schema for agents.