You have data in a CSV and you need it in a database table. Importing through a GUI works for a one-off, but when you want the load to be repeatable, scriptable, or part of a migration, INSERT statements are what you reach for. Writing them by hand for more than a few rows is tedious and error-prone.
The short version: paste a CSV, set the table name and your database, and copy the generated SQL. The CSV to SQL tool runs on your device, so nothing is uploaded.
What the conversion produces
Each data row becomes an INSERT statement (or one row of a batched insert) targeting the table you name, with columns taken from the header row. A file like this:
name,age,city
Kim,27,Seoul
Ana,34,Lisbon
becomes something like:
INSERT INTO "people" ("name", "age", "city") VALUES ('Kim', 27, 'Seoul');
INSERT INTO "people" ("name", "age", "city") VALUES ('Ana', 34, 'Lisbon');
Notice that the ages are unquoted while the names and cities are. That distinction is the part that is fiddly to get right by hand, and it matters: quote a number and some columns reject it; forget to quote text and the statement fails.
Quoting and escaping, done for you
Two details cause most hand-written INSERT errors. The first is text that contains an apostrophe, like O'Hara, which ends the string early unless the apostrophe is doubled. The second is identifiers, the table and column names, which each database quotes differently. The conversion doubles apostrophes in values and quotes identifiers the way your chosen database expects, so the output runs as-is.
Choosing your options
A few switches tailor the output:
- Database dialect sets how names are quoted: backticks for MySQL, brackets for SQL Server, double quotes elsewhere.
- Batch mode emits one multi-row
INSERT ... VALUES (...), (...)instead of a statement per row, which loads faster for large files. - CREATE TABLE adds a table definition above the inserts, so you can create and populate in a single paste.
- Empty cells as NULL writes blank values as
NULLrather than an empty string, when that distinction matters to your schema.
How to convert CSV to SQL
Step 1: Add the CSV
Paste CSV text into the tool or drop in a file. The first row is read as the column names.
Step 2: Set the table and dialect
Type the target table name and pick your database. Turn on batching or a CREATE TABLE if you want them.
Step 3: Copy the SQL
Copy the statements straight into your client, a migration file or a script.
Related conversions
If you need a different interchange format rather than SQL, the CSV to XML tool produces well-formed XML from the same data. And to load the CSV into a spreadsheet instead of a database, the CSV to Excel converter builds a typed workbook.