CSV to SQL

Runs in browser Database

Upload or paste CSV, infer column types (INT, DECIMAL, DATE, VARCHAR, BOOLEAN), pick a dialect, and generate DDL plus batched INSERTs.

Privacy: This tool runs entirely in your browser. Your input never leaves your device.
Loading tool…

What changes when data is converted between JSON, CSV, YAML and XML?

The four formats model data differently: JSON and YAML carry nesting and types, CSV is a flat table of strings, and XML distinguishes elements from attributes. A converter therefore has to make choices — how to flatten nested objects into columns, how to type "42" and "true", where attributes go — and the right choice depends on what the receiving system expects.

Read the guide: What is JSON?

How to use CSV to SQL

  1. Paste the CSV (header row required).
  2. Set the table name, dialect, primary key and batch size.
  3. Copy the DDL and INSERT statements into your migration or seed script.

CSV to SQL features

  • Detects the delimiter (comma, semicolon, tab, pipe) automatically
  • Infers INT, BIGINT, DECIMAL, BOOLEAN, DATE, TIMESTAMP, UUID and VARCHAR(n)
  • Generates CREATE TABLE with NOT NULL and an optional PRIMARY KEY
  • Batched multi-row INSERTs with dialect-correct literals
  • Column names normalised to safe snake_case identifiers
  • Schema table shows every inferred type for review

CSV to SQL example

Infer a schema

Input:

id,email,signed_up,score
1,layla@example.com,2026-03-14,87.5

Output:

CREATE TABLE IF NOT EXISTS users (
  id INT NOT NULL,
  email VARCHAR(40) NOT NULL,
  signed_up DATE NOT NULL,
  score DECIMAL(3,1) NOT NULL
);

INSERT INTO users (id, email, signed_up, score) VALUES
  (1, 'layla@example.com', '2026-03-14', 87.5);

Frequently asked questions about CSV to SQL

How are column types inferred?

Every value in a column is inspected. Integers become INT/BIGINT, decimals DECIMAL(p,s), true/false BOOLEAN (or BIT/TINYINT(1)), ISO dates DATE/TIMESTAMP, UUIDs UUID/CHAR(36), and the rest VARCHAR with headroom: twice the longest value, rounded up to a multiple of 10 and capped at 4000. Mixed columns fall back to text.

What happens to column names with spaces or symbols?

They are converted to snake_case identifiers ("Order ID" → order_id) and quoted when they collide with reserved words. The schema table shows the mapping.

Can I skip CREATE TABLE?

Yes, untick "Include CREATE TABLE" when the table already exists.

Is there a size limit?

Files up to 2 MB are processed in the browser. For larger imports, use your database's native bulk loader (LOAD DATA, COPY, BULK INSERT).

References