CSV to SQL Converter
To convert CSV to SQL: paste CSV with a header row. The first row defines column names for the INSERT INTO statement. Each subsequent row becomes a VALUES tuple. The tool auto-detects types: integers stay unquoted, strings get single quotes, empty values become NULL. Optionally generate a CREATE TABLE with inferred column types (INTEGER, VARCHAR, DATE, BOOLEAN, DECIMAL).
Convert CSV data to SQL INSERT statements and CREATE TABLE definitions instantly. Auto-detects column types (INTEGER, DECIMAL, BOOLEAN, DATE, VARCHAR). Supports comma, tab, semicolon, and pipe delimiters. Batch INSERT for large datasets. Quote identifiers for reserved words.
CSV Input
CSV Value to SQL Type Mapping
| CSV Value | Inferred SQL Type | Example |
|---|---|---|
| 42, -7 | INTEGER | 42 |
| 3.14, 29.99 | DECIMAL(10,2) | 29.99 |
| true, false | BOOLEAN | TRUE |
| 2026-03-13 | DATE | '2026-03-13' |
| "hello" | VARCHAR(n) | 'hello' |
| (empty), null | NULL | NULL |
How to Use
- 1
Paste your CSV data
Paste CSV with a header row into the input area, or click a preset (Users, Products, Orders, Tab-separated) to see an example
- 2
Configure options
Set the table name, toggle CREATE TABLE, enable quote identifiers if needed, and choose batch size for INSERT statements
- 3
Review SQL output
The generated SQL appears instantly with CREATE TABLE (if enabled) and INSERT INTO statements with properly typed values
- 4
Copy to your database
Click the copy button to copy the SQL and paste it into your database client, migration file, or seed script
Frequently Asked Questions
- How does CSV to SQL conversion work?
- The converter reads your CSV headers as column names and each row as a data record. It generates SQL INSERT INTO statements with properly typed values. Strings are quoted, numbers stay unquoted, booleans become TRUE/FALSE, and empty values become NULL. An optional CREATE TABLE statement infers column types from the data.
- What column types does the CREATE TABLE auto-detect?
- The converter analyzes all values in each column to infer the SQL type. Pure integers become INTEGER, decimal numbers become DECIMAL(10,2), true/false values become BOOLEAN, YYYY-MM-DD dates become DATE, and text becomes VARCHAR(n) where n is based on the longest value. Empty columns default to TEXT.
- What CSV delimiters are supported?
- The tool auto-detects four delimiters: comma (,), tab, semicolon (;), and pipe (|). It checks the first line of your input to determine which delimiter to use. Quoted fields with commas inside are handled correctly using RFC 4180 parsing rules.
- Can I generate batch INSERT statements?
- Yes. Use the Batch dropdown to control how many rows per INSERT statement: 1, 100, 500, or 1000. Batch INSERTs are more efficient for importing large datasets into MySQL, PostgreSQL, or SQLite because they reduce the number of round trips to the database.
- Should I use quoted identifiers in my SQL?
- Enable "Quote identifiers" if your column names contain reserved words (like order, group, select) or special characters. This wraps table and column names in double quotes, which prevents SQL syntax errors. PostgreSQL uses double quotes by default; MySQL uses backticks (adjust after copying).
- Does this work with MySQL, PostgreSQL, and SQLite?
- The generated SQL uses standard ANSI syntax compatible with MySQL, PostgreSQL, SQLite, and most SQL databases. Some databases may need minor adjustments: MySQL uses backticks instead of double quotes for identifiers, and type names may vary (e.g., INT vs INTEGER).