GALAXY OF TOOLS

DEV SECTOR

CSV to SQL Converter (INSERT & UPDATE Queries)

Turn CSV or JSON into CREATE TABLE plus INSERT or UPDATE statements for MySQL, PostgreSQL, SQLite or SQL Server.

395 B
PRIMARY KEY in CREATE TABLE; the WHERE column for UPDATE
4rows
9columns
2statements
765 Bof SQL

MySQL / MariaDB · delimiter: comma (detected) · primary key: id

Column types (detected from every value — override any column)
ColumnDetectedSQL typeOverrideNULLsExample
idIntegerINT01001
nameTextVARCHAR(50)0Priya Sharma
emailTextVARCHAR(50)0priya@example.com
cityTextVARCHAR(50)0Mumbai
signup_dateDateDATE02026-01-14
ordersIntegerINT012
balanceDecimalDECIMAL(6,2)01499.50
vipBooleanBOOLEAN0true
notesTextVARCHAR(50)2Prefers email; no calls
Try it in the SQL playground

Conversion runs in your browser; the data is never uploaded.

Runs entirely in your browser. Nothing you enter or upload is sent to a server.

Convert CSV to SQL INSERT and UPDATE queries

This CSV to SQL converter turns a spreadsheet export into ready-to-run SQL: a CREATE TABLE statement with a sensible type for every column, followed by batched INSERT statements — or one UPDATE … WHERE per row when you need to change rows that already exist. Pick MySQL/MariaDB, PostgreSQL, SQLite or SQL Server and the identifiers, string literals, booleans and types change to match that database.

It is meant for the jobs that come up every week: loading a client’s spreadsheet into a staging table, seeding a development database, turning a price list into an update script, or moving a JSON API response into SQL. JSON input works too — switch to JSON and paste an array of objects.

Everything runs in your browser, so customer lists and other private data never leave your device.

How to use the CSV to SQL Converter

  1. Paste CSV into CSV data, drop a .csv file on it or press Load file. For JSON, choose JSON first (a .json file switches automatically).
  2. Choose the Database and type the Table name. Use schema.table to include a schema.
  3. Pick INSERT (+ CREATE TABLE) or UPDATE … WHERE key, and the Primary / key column. Auto picks a column named id when its values are unique.
  4. Check Column types. Each column is typed from all of its values; use Override if, say, a numeric code should stay text.
  5. Set the options you need — rows per INSERT, quoting, DROP TABLE IF EXISTS, a transaction, NULL handling — then Copy SQL or Download .sql.

CSV to SQL Converter features

Real CSV parsing

Follows RFC 4180: quoted fields, doubled quotes (""), commas and line breaks inside quotes, CRLF or LF endings and a byte-order mark. Comma, semicolon, tab and pipe are detected automatically.

Types inferred from every value

Integers (INT or BIGINT by range), decimals with exact precision and scale, booleans, ISO dates and timestamps, and text sized to the longest value. Numbers with leading zeros, such as PIN codes and phone numbers, stay text.

Correct escaping per database

Single quotes are doubled everywhere; MySQL also gets backslashes escaped; SQL Server text uses N'…' literals. Reserved or unusual names are quoted with backticks, double quotes or brackets.

Batched INSERTs

One INSERT per row or multi-row INSERTs of 10 to 5,000 rows. SQL Server is capped at its limit of 1,000 rows per VALUES list.

UPDATE queries from CSV

Generate UPDATE table SET … WHERE key = …; for every row, keyed on any column — handy for bulk price or status changes.

JSON to SQL

An array of objects becomes rows; keys become columns; nested objects and arrays are stored as JSON text.

How column types are chosen

Every non-empty value in a column is checked, not just the first few rows, so one stray word turns a column into text instead of breaking your import later. Empty cells (and the words NULL or \N, if that option is on) count as NULL and do not affect the type.

Values in the columnMySQLPostgreSQLSQLiteSQL Server
true / falseBOOLEANBOOLEANINTEGER (1/0)BIT (1/0)
Whole numbers up to 2,147,483,647INTINTEGERINTEGERINT
Larger whole numbersBIGINTBIGINTINTEGERBIGINT
Decimals such as 1499.50DECIMAL(p,s)NUMERIC(p,s)REALDECIMAL(p,s)
2026-10-24DATEDATETEXTDATE
2026-10-24 09:30:00DATETIMETIMESTAMPTEXTDATETIME2
Anything elseVARCHAR(n) or TEXTTEXTTEXTNVARCHAR(n) or (MAX)

Escaping and quoting rules used

  • Strings: a single quote becomes two (O'Neil → 'O''Neil'), the standard SQL rule all four databases accept. Line breaks inside a value are kept inside the literal.
  • MySQL backslashes: MySQL treats \ as an escape character unless the NO_BACKSLASH_ESCAPES SQL mode is on, so C:\temp is written as 'C:\\temp'. PostgreSQL (with the default standard_conforming_strings), SQLite and SQL Server keep backslashes as typed.
  • Names: left bare when they are plain letters, digits and underscores; otherwise — or when the name is a reserved word such as order or when — quoted as `name`, "name" or [name]. PostgreSQL names with capitals are quoted so their case survives.
  • Dates are written as ISO 8601 strings, which every database casts to its date and timestamp types.

Loading the result

Run the file with your usual client — mysql db < customers.sql, psql -f customers.sql, sqlite3 shop.db < customers.sql or SQL Server Management Studio. For very large files a native bulk loader (LOAD DATA, COPY, .import, BULK INSERT) is faster; this tool is ideal up to a few hundred thousand rows. To try the statements first, open the online SQL compiler, a SQLite playground in your browser. Tidy the output with the SQL formatter, or turn the same CSV into JSON with CSV to JSON.

CSV to SQL Converter FAQ

How do I convert a CSV file to SQL INSERT queries?

Load the CSV, choose your database and table name, keep “INSERT (+ CREATE TABLE)” selected and press Download .sql. The file contains the CREATE TABLE statement followed by INSERT statements for every row.

Can I create an UPDATE query from a CSV?

Yes. Choose “UPDATE … WHERE key” and pick the key column. Each row becomes UPDATE table SET col = value, … WHERE key = value;. Rows with an empty key are skipped and reported.

Which databases does the CSV to SQL converter support?

MySQL and MariaDB, PostgreSQL, SQLite and Microsoft SQL Server. The types, quoting, boolean literals, transaction keywords and batch limits follow each one.

Why is a numeric-looking column typed as text?

Values with leading zeros (00123), plus signs, thousands separators or any non-numeric entry make the column text so nothing is lost. Use Override to force a numeric type; values that are not valid numbers are then still written as quoted strings.

How are empty cells handled?

With “Empty cells → NULL” on, empty fields become NULL; turn it off to insert empty strings. The words NULL and \N (the MySQL dump marker) can also be read as NULL.

Is my data uploaded anywhere?

No. Parsing and SQL generation happen in your browser tab and nothing is sent to a server.

You might also need