What is a SQL INSERT generator?
An INSERT statement adds rows to a database table. Writing them by hand for more than a few rows is slow and error-prone, especially quoting text, escaping apostrophes and remembering NULL for missing values.
This generator turns data you already have, a CSV export or a JSON array from an API, into valid INSERT statements for PostgreSQL, MySQL, MariaDB, SQLite, Oracle or SQL Server. Developers use it to seed test databases, write migration scripts, move a spreadsheet into a table, and share reproducible test data in bug reports.
How to use the CSV
1.Paste the rows
CSV with a header row, or a JSON array of objects.
2.Set the table and dialect
Name the table and choose how column names are quoted for your database.
3.Copy the SQL
Optionally include a CREATE TABLE with column types guessed from the data.
Example: three customers from a CSV
Columns id, name, email, balance, active, where Sam O'Neil has an empty balance:
- Row 1
- (1, 'Priya Rao', 'priya@example.com', 1250.50, TRUE)
- Row 2
- (2, 'Sam O''Neil', 'sam@example.com', NULL, FALSE)
- Row 3
- (3, 'Li Wei', 'li@example.com', 98, TRUE)
- Statement
- INSERT INTO "customers" (…) VALUES with 3 rows
The apostrophe is escaped, the empty balance becomes NULL and numbers stay unquoted.
Values written correctly
Text is wrapped in single quotes with any apostrophes doubled, so O'Neil becomes 'O''Neil' and can't break the statement. From CSV, plain numbers, true and false, and the word NULL are written without quotes; empty cells become NULL unless you turn that off. JSON values keep their types, and nested objects are stored as JSON text.
A single multi-row INSERT is much faster to run than one statement per row. For very large imports, use your database's bulk loader, such as COPY in PostgreSQL or LOAD DATA in MySQL.
Frequently asked questions
Which column types does CREATE TABLE use?
INTEGER, DECIMAL, BOOLEAN or DATE when every value fits, otherwise TEXT. Review them before running it.
How are apostrophes handled?
Each ' inside a value is doubled, the standard SQL escape, so names like O'Neil insert correctly.
Can I use a schema name?
Yes. Type it as schema.table; each part is quoted separately.
Is there a row limit?
No fixed limit, but some databases cap the size of one statement. Untick One INSERT with many rows for huge files.
Related tools
SQL Formatter & Beautifier
Beautify or minify SQL for MySQL, PostgreSQL, SQL Server and more.
SQL IN Clause Generator
Turn a list of values into a SQL IN (…) clause.
JSON ↔ CSV Converter
Convert JSON arrays to CSV and CSV back to JSON.
JSON Formatter & Validator
Pretty-print, minify, sort and validate JSON with line-numbered errors.
JSON to TypeScript Interface Generator
Generate TypeScript interfaces or types from a JSON sample.
JSON ↔ YAML Converter
Convert JSON to YAML and YAML to JSON.
More Developer tools
JSON & data
CSV tools
Network & system
Web & API
Git & releases
Encoding & security
- Base64 encode & decode
- URL encode & decode
- JWT decoder
- Hash generator
- HTML entity encoder
- Text to binary
- Morse code translator
- Caesar cipher & ROT13
- Random string generator
- Secret key generator
- 2FA code generator (TOTP)
- Encrypt & decrypt text
- Encrypt & decrypt files
- SSH key generator
- Base32 encoder and decoder
- Unicode escape converter
- Nano ID generator
- JWT generator
Text & code
- Regex tester
- Text diff checker
- Cron expression explainer
- Lorem ipsum generator
- Markdown previewer
- Slug generator
- Strip HTML tags
- Unicode character inspector
- URL parser
- Markdown TOC generator
- cURL converter
- Whitespace visualizer
- Markdown link extractor
- Regex escape
- Regex match extractor
- Split text by regex
- HTML, CSS and JS playground
- Mock data generator
- Keyboard event tester
- ASCII table