CREATE TABLE Generator From JSON or CSV
Generate a CREATE TABLE statement from a JSON array or CSV sample, with column types inferred for MySQL, PostgreSQL or SQLite and an optional id primary key.
Free · No sign-up · Your inputs stay in your browser
Input
Generate CREATE TABLE from JSON or CSV
Output
DDL
7 columns from 2 rows
Types come from the sample: whole numbers become INT or BIGINT, decimals DECIMAL with the widest scale seen (never FLOAT, which cannot hold money exactly), ISO dates DATE or a timestamp type, objects JSON, and a column that is empty in any row is NULL. Review the lengths: a sample cannot know the longest email you will ever store.
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
Types are a starting point
A sample shows what the data looked like, not what it may become. Review string lengths (VARCHAR sizes are rounded up to 50, 100 or 255), make columns that must always be present NOT NULL by intent rather than by accident, and add the indexes your queries need: the generator only creates the primary key.
Per database
MySQL gets an InnoDB table with utf8mb4, so emoji and all of Unicode fit; PostgreSQL gets an identity column, TIMESTAMPTZ and JSONB; SQLite gets its type affinities, since it stores any value in any column. Money is never typed as FLOAT, which cannot represent 0.1 exactly.