← All tools

SQL Table Generator

Generate CREATE TABLE with explicit types, defaults, primary keys, unique constraints and integer identities.

sql-table-generatorLOCAL WORKSPACE

Enabling local controls…

Column 1
Column 2
Column 3

Preview: first 32,000 characters. Copy, download and expanded text retain all content. Select complete text if copying fails.

CREATE TABLE IF NOT EXISTS "tasks" (
  "id" INTEGER GENERATED BY DEFAULT AS IDENTITY NOT NULL,
  "title" VARCHAR(255) NOT NULL,
  "done" BOOLEAN NOT NULL DEFAULT FALSE,
  PRIMARY KEY ("id")
);
Expand complete selectable text
CREATE TABLE IF NOT EXISTS "tasks" (
  "id" INTEGER GENERATED BY DEFAULT AS IDENTITY NOT NULL,
  "title" VARCHAR(255) NOT NULL,
  "done" BOOLEAN NOT NULL DEFAULT FALSE,
  PRIMARY KEY ("id")
);

How to use this tool

Choose a dialect, then add or edit up to 30 columns. Mark multiple columns as primary to create one composite key in form order. Identity requires one integer primary key and no explicit default. Copy or download the result locally.

When not to use it

This tool generates one table with typed defaults or CURRENT_TIMESTAMP. Key length, unique constraints and type enforcement depend on the engine. MySQL output targets InnoDB and uses MySQL 8.0.13+ for expression defaults. PostgreSQL identity needs version 10+. SQL Server CREATE TABLE has no IF NOT EXISTS clause, and a single-column UNIQUE constraint allows only one NULL. SQLite uses type affinity and does not enforce the declared text length or decimal precision.