CREATE TABLE Generator
Paste table data from Excel, Google Sheets or CSV to generate a CREATE TABLE statement with column types inferred automatically (integer, decimal, date, boolean, varchar). Supports PostgreSQL, MySQL, SQLite and SQL Server, with optional auto-increment id and NOT NULL constraints.
About this tool
The CREATE TABLE Generator reads tabular data pasted from Excel, Google Sheets or CSV and writes a matching CREATE TABLE statement, inferring a sensible column type for each column — integer, decimal, date, boolean or varchar — from the values it sees. It saves the fiddly step of translating a spreadsheet into a schema by hand.
It targets PostgreSQL, MySQL, SQLite and SQL Server, with options for an auto-increment id column and NOT NULL constraints. It is a quick way to bootstrap a table for prototyping or a data import. All analysis happens in your browser, so the sample data stays private.
How to use
- Paste your rows from a spreadsheet or CSV, including the header row.
- Choose the target database dialect: PostgreSQL, MySQL, SQLite or SQL Server.
- Let the tool infer each column type from the values, then adjust if needed.
- Optionally add an auto-increment id primary key column.
- Toggle NOT NULL constraints for columns that should always have a value.
- Copy the CREATE TABLE statement into your migration or database console.
Features
- Automatic column type inference: integer, decimal, date, boolean, varchar.
- Dialect-aware output for PostgreSQL, MySQL, SQLite and SQL Server.
- Optional auto-increment id primary key column.
- NOT NULL constraint toggle for required columns.
- Header row becomes the column names in the schema.
- Fast way to bootstrap a table from sample or imported data.
- Runs locally — the data you paste is never uploaded.
Frequently asked questions
Does my sample data leave the browser?
No. Type inference and statement generation happen locally in your browser, so the rows you paste are never sent to a server.
How does the tool decide each column type?
It scans the values in each column and picks the narrowest type that fits — whole numbers become integer, numbers with decimals become decimal, recognisable dates become date, true/false values become boolean, and everything else becomes varchar.
Why should I review the inferred types before running the DDL?
Inference is based only on the sample you paste, so a column that looks numeric might need to allow text later, or a varchar length may be too small for future values. Treat the output as a strong starting point and adjust for production.
Can it add a primary key automatically?
Yes. You can enable an auto-increment id column that acts as the primary key, using the right syntax for the selected dialect such as SERIAL, AUTO_INCREMENT or IDENTITY.
Does the generated statement differ between databases?
Yes. Type names and auto-increment syntax vary between PostgreSQL, MySQL, SQLite and SQL Server, so the tool tailors the DDL to the dialect you select.