CSV to SQL Insert Generator
Convert CSV data into SQL INSERT statements for MySQL, PostgreSQL, or SQLite. Configure batch size, table name, and delimiter.
Frequently Asked Questions
What SQL dialects does the generator support?
PostgreSQL (double-quote identifiers), MySQL (backtick identifiers), and SQLite (double-quote identifiers). The core INSERT syntax is the same across all three.
How are special characters in CSV values handled?
Single quotes within string values are escaped by doubling them (e.g., O'Brien → O''Brien), which is the standard SQL escape syntax across all major databases.
What does the batch size option do?
Instead of generating one INSERT statement per row, batch inserts group multiple rows into a single INSERT with multiple value tuples. This is significantly faster for bulk imports (e.g., 100 rows per INSERT statement).
Can I include a CREATE TABLE statement?
Yes. Enable 'Include CREATE TABLE' to prepend a CREATE TABLE IF NOT EXISTS statement with all columns defined as TEXT. You can then alter column types in your database.
My CSV uses semicolons as delimiters. Is that supported?
Yes. The tool supports comma (,), semicolon (;), tab (\t), and pipe (|) as delimiters. Select the correct delimiter from the options.
SQL INSERT Syntax
-- Single row INSERT INTO users (id, name, email) VALUES (1, 'Alice', 'alice@example.com'); -- Multi-row batch (much faster than one statement per row) INSERT INTO users (id, name, email) VALUES (1, 'Alice', 'alice@example.com'), (2, 'Bob', 'bob@example.com'), (3, 'Carol', 'carol@example.com');
MySQL vs PostgreSQL vs SQLite Differences
| Feature | MySQL | PostgreSQL | SQLite |
|---|---|---|---|
| Identifier quotes | Backtick `col` | Double-quote "col" | Both accepted |
| String escaping | \' or '' | '' | '' |
| IGNORE duplicates | INSERT IGNORE | ON CONFLICT DO NOTHING | ON CONFLICT IGNORE |
| Batch row limit | 65535 rows/stmt | No hard limit | No hard limit |