CSV to SQL Converter

Turn CSV rows into CREATE TABLE and INSERT statements.

Runs in your browser. Nothing is uploaded — your input is processed on this device and discarded when you close the tab.

CSV to SQL Converter

How to use this tool

  1. Paste CSV data with a header row on top and name the table.
  2. Press Convert to see a CREATE TABLE plus one INSERT per row.
  3. Use Load sample for a name containing an apostrophe, to show the quoting.

Worked example

The sample row O'Brien, 30 under table my_table produces INSERT INTO my_table (name, age) VALUES ('O''Brien', '30'); — the apostrophe is doubled, which is the SQL way to keep it inside the string. The CREATE TABLE line declares both columns as TEXT, because CSV carries no types.

What this tool does not do / Limits

All columns are declared TEXT and all values are quoted as strings, because CSV carries no types and guessing types could corrupt data. Identifiers are quoted with double quotes and internal double quotes are doubled. Always review the output before running it against a real database.

Frequently asked questions

Are numbers inserted as numbers?

No. Every value is quoted as text, which databases accept for numeric columns in most cases, but you may change the column types by hand.

Is the output safe to run?

Values are quoted by doubling single quotes, but you should still review the output and run it on a test database first.

Related tools