Skip to content

CSV to SQL

Generate CREATE TABLE and INSERT statements from a CSV file for MySQL/MariaDB, PostgreSQL or SQLite, with safely escaped values and inferred column types.

Secure server processing CSV → SQL

Files are uploaded over HTTPS, processed on our server, and automatically deleted within 1 hour(s).

To convert CSV to SQL, choose the CSV, enter a table name, pick your database and select Generate SQL. You get a .sql file with an optional CREATE TABLE statement and INSERT statements in batches of 500 rows.

How to use the CSV to SQL

  1. 1

    Choose the CSV

    The first row must contain column names.

  2. 2

    Name the table and pick a database

    MySQL/MariaDB, PostgreSQL or SQLite.

  3. 3

    Generate and download

    Run the .sql file in your database client.

How it works

Column types are inferred from the first 1,000 rows: whole numbers become BIGINT, decimals DECIMAL(20,6), everything else TEXT. Empty cells become NULL. Identifiers and values are escaped for the chosen dialect (e.g. backticks and doubled quotes for MySQL), so unusual headers or quotes in the data can’t break the SQL. Uploaded over HTTPS, processed on our server and deleted automatically within an hour.

Features

  • Three dialects

    Correct quoting for each database.

  • Type inference

    Numbers stay numeric.

  • Batched inserts

    Fast imports for large files.

Examples

INSERT INTO `customers` (`id`, `name`) VALUES\n  (1, 'Asha'),\n  (2, 'Ravi O''Neil');

Privacy and file handling

Where it runs
Processed on our server
Retention
Uploaded and converted files are deleted automatically within 1 hour(s).
File size limit
5 MB per file
Cost
Server mode: 3 free a day, then 1 credit(s) each.

Files are uploaded over HTTPS, processed on our server, and automatically deleted within 1 hour(s).

Limitations

  • Review inferred types before production use (e.g. phone numbers should be TEXT).
  • Up to 50,000 rows.

Frequently asked questions

How are quotes in my data handled?

Single quotes are doubled (O''Neil) and backslashes escaped for MySQL, so the SQL is valid and safe.

Can I skip CREATE TABLE?

Yes — untick the option to generate INSERT statements only.

Was this tool helpful?

Thanks for the feedback.

Last reviewed