idSERIALPK
usernameVARCHARNNUQ
emailVARCHARNNUQ
created_atTIMESTAMPNNDF
Design database schemas visually and generate SQL for PostgreSQL, MySQL, SQLite.
-- Schema generated by DB Schema Designer
-- Dialect: PostgreSQL
-- Generated: 2026-08-04T11:46:58.166Z
CREATE TABLE IF NOT EXISTS "users" (
"id" SERIAL PRIMARY KEY,
"username" VARCHAR(100) NOT NULL UNIQUE,
"email" VARCHAR(255) NOT NULL UNIQUE,
"created_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS "posts" (
"id" SERIAL PRIMARY KEY,
"user_id" INTEGER NOT NULL,
"title" VARCHAR(255) NOT NULL,
"body" TEXT,
"published" BOOLEAN DEFAULT false,
FOREIGN KEY ("user_id") REFERENCES "users"("id")
);
CREATE TABLE IF NOT EXISTS "tags" (
"id" SERIAL PRIMARY KEY,
"name" VARCHAR(50) NOT NULL UNIQUE
);
-- Junction table for N-N: posts <-> tags
CREATE TABLE IF NOT EXISTS "posts_tags" (
"posts_id" INTEGER NOT NULL,
"tags_id" INTEGER NOT NULL,
PRIMARY KEY ("posts_id", "tags_id"),
FOREIGN KEY ("posts_id") REFERENCES "posts"("id"),
FOREIGN KEY ("tags_id") REFERENCES "tags"("id")
);Enter a table name and press "Add Table". Each new table comes with an auto-incrementing ID column as its primary key.
For each table add columns by selecting data types (INTEGER, VARCHAR, DECIMAL, JSONB...) and constraints (PRIMARY KEY, NOT NULL, UNIQUE, DEFAULT, REFERENCES).
In the Relationships section, choose table and column source/destination and type (1-1, 1-N, N-N). For N-N relationships, the tool automatically generates a junction table.
Select PostgreSQL, MySQL or SQLite: generated DDL is updated in real-time. Copy to notes or download the .sql file.
For each N-N relationship, the tool automatically generates a dedicated junction table with two external key columns (one for each involved table) and a composite primary key, eliminating the need to manually model it.
Data types differ between MySQL and SQLite.
Yes, the example schema (users, posts, tags with 1-N and N-N relationships) is a starting point that can be modified: you can rename tables and columns freely, add or remove them as needed, or press "Reset" to start from scratch.
No, generate the syntactically correct SQL DDL (CREATE TABLE, FOREIGN KEY) for the chosen dialect, but do not perform advanced semantic validation (e.g. dependency cycles, cascade policies): always verify the script before running it on a production database.