💙 Supporting healthcare non-profits: Metadataloop is free for 6–12 months. Contact Us to get started.
Free Online Tool

CSV to MySQL CREATE TABLE

Paste a CSV sample, get a MySQL-dialect DDL with proper types and lengths.

Open the Schema Inferrer →

Overview

Generate a MySQL CREATE TABLE from any CSV sample. Types are mapped to MySQL conventions: BOOLEAN values become TINYINT(1), UUIDs become CHAR(36), timestamps become DATETIME, and string columns are bucketed into VARCHAR(N) sizes that fit InnoDB row limits. Output is ready to paste into MySQL Workbench, the mysql CLI, or your favorite migration tool.

What you get

✓ INCLUDED
MySQL-native types: INT, BIGINT, DECIMAL, TINYINT(1), DATE, DATETIME, CHAR(36), VARCHAR(N), TEXT
✓ INCLUDED
Avoids row-size overruns by bucketing VARCHAR lengths
✓ INCLUDED
Detects boolean columns from yes/no/true/false/1/0
✓ INCLUDED
Emits backtick-quoted identifiers when reserved words are detected
✓ INCLUDED
Handles UTF-8 multi-byte characters in your sample correctly

Type detection reference

Sample values and the dialect-native type they map to.

Sample valueInferred type
0, 1, 42INT
12345678901234BIGINT
0.99, 12.50DECIMAL(10,2)
true, 0, yes, NOTINYINT(1)
2024-03-15DATE
2024-03-15 09:30:00DATETIME
a3bb189e-8bf9-3888-…CHAR(36)
"short text"VARCHAR(64)
very long article bodyTEXT

Example

Input
order_id,user_id,total,placed_at,paid
1001,42,29.99,2024-03-15 14:22:10,1
1002,99,150.00,2024-03-15 14:25:01,0
Output
CREATE TABLE orders (
    order_id  INT          NOT NULL,
    user_id   INT          NOT NULL,
    total     DECIMAL(10,2) NOT NULL,
    placed_at DATETIME     NOT NULL,
    paid      TINYINT(1)   NOT NULL
);

Frequently asked questions

Why TINYINT(1) instead of BOOLEAN?
MySQL aliases BOOLEAN to TINYINT(1) under the hood. We emit the underlying type so the DDL is portable across MySQL versions and MariaDB.
Does it pick the right collation/charset?
We do not emit ENGINE/CHARSET clauses — append them yourself, e.g. ENGINE=InnoDB DEFAULT CHARSET=utf8mb4.
Can it handle 100k-row CSVs?
Type inference only needs a few thousand rows. Trim larger files to a representative sample for faster results.

Try it now

No signup, no install — runs entirely in your browser.

Open the Schema Inferrer →

⚠ Confirm Delete