CSV to SQL converter

To convert CSV to SQL, paste the CSV data below: the tool generates CREATE TABLE and INSERT statements for MySQL, PostgreSQL, SQLite or SQL Server – with detected column types and properly escaped text. Everything in your browser.

Source: IETF – RFC 4180: Common Format and MIME Type for CSV Files. Updated: .

My Toolbox

Result

SQL
CREATE TABLE "products" ( "id" INTEGER, "name" TEXT, "price" DOUBLE PRECISION, "date" DATE ); INSERT INTO "products" ("id", "name", "price", "date") VALUES (1, 'Apple', 1.2, '2026-10-01'); INSERT INTO "products" ("id", "name", "price", "date") VALUES (2, 'Pear', 0.95, '2026-10-02'); INSERT INTO "products" ("id", "name", "price", "date") VALUES (3, 'Kiwi, green', NULL, '2026-10-03');
Summary
3 rows, 4 columns · separator: comma · table: products · columns: id: integer, name: text, price: decimal number, date: date

How it is calculated

Converting CSV to SQL means turning a table in text form into a table in the database: first the structure (CREATE TABLE), then the rows (INSERT). The tool reads your CSV data in your browser following RFC 4180, derives the column types from all values and writes the SQL in your database’s dialect.

How it works

  1. Paste CSV, for example from Excel or an export (separator and decimal mark are detected).
  2. Choose the database and table name; if you like, clean up names, leave out CREATE TABLE or bundle INSERTs.
  3. Copy the SQL and run it in your database tool.

What the tool detects and adjusts

Limits

The generated SQL is meant for small to medium amounts of data. For very large files, COPY (PostgreSQL), LOAD DATA (MySQL), .import (SQLite) or BULK INSERT (SQL Server) are faster.

Privacy

The data never leaves your browser. Next steps: CSV to JSON, CSV to Excel or format SQL.

Frequently asked questions

How do I convert CSV to SQL?

Paste the CSV and choose the database and table name: the tool generates CREATE TABLE and INSERT statements that you copy and run.

Which databases are supported?

MySQL/MariaDB, PostgreSQL, SQLite and SQL Server. Types, name quoting and escaping follow the chosen system.

How does the tool detect column types?

From all values of a column: only whole numbers give INT/BIGINT, decimals give decimal numbers, true/false a boolean, valid dates DATE. Everything else becomes text.

Why are postcodes text?

Because leading zeros (for example 01067) would be lost as a number. Numbers with a leading zero therefore stay text.

Can I convert CSV to SQL without uploading the file?

Yes. Everything runs in your browser.

How do I load very large CSV files into a database?

Use the database’s import commands (COPY, LOAD DATA, .import, BULK INSERT). This tool is meant for small to medium amounts of data and for creating the table structure.

Sources and legal basis

As of: · Editorial policy

Related tools