CSV to SQL — CREATE TABLE and INSERT Statements for MySQL, PostgreSQL, SQLite, SQL Server
Generate escaped SQL CREATE TABLE DDL and multi-row INSERT statements from CSV.
4 rows, 9 columns, 1 INSERT statements, comma delimiter (detected).
| Column | Detected content | SQL type | Empty cells |
|---|---|---|---|
| id | integer | INT | 0 |
| hostname | text | VARCHAR(11) | 0 |
| ip | text | VARCHAR(10) | 0 |
| vlan | integer | INT | 0 |
| lokasi | text | VARCHAR(12) | 0 |
| aktif | true/false | BOOLEAN | 0 |
| dipasang | date | DATE | 0 |
| daya_w | decimal | DECIMAL(5, 2) | 0 |
| catatan | text | VARCHAR(22) | 1 |
- Types are inferred from the whole column: integer, decimal, true/false, a YYYY-MM-DD date, or text. Numbers with a leading zero such as 007 stay text so postal codes and IDs do not change.
- Text is escaped for the database: quotes are doubled (''), MySQL also doubles backslashes, and SQL Server uses N'…' for Unicode. Column names are always quoted (`…`, "…" or […]).
When to use the CSV to SQL CREATE TABLE & Batched INSERT Converter
Column types inferred from the data
Every column is checked in full: integer, decimal with enough precision, true/false, a YYYY-MM-DD date, or text. Numbers with a leading zero such as 007 stay text so postal codes and staff numbers do not change.
Escaping for each database
Single quotes are doubled in every database. MySQL also doubles backslashes, SQL Server uses N'…' for Unicode text, and column names get each database's identifier quotes.
Many rows per statement
Rows are grouped into multi-row INSERT statements, which import far faster than one statement per row. The rows per statement can be set; SQL Server is capped at 1,000 rows per statement.
Tested against a real database
SQLite and PostgreSQL output is run in SQLite and read back, and MySQL and SQL Server output is read with a separate literal reader. Every value, quotes and backslashes included, comes back the same.
Frequently asked questions
What happens to empty cells?
Empty cells in number, date and true/false columns always become NULL; in text columns they can be NULL or an empty string, as you choose.
Can I skip the table definition?
Yes. Turn the option off when the table already exists and only the INSERT statements are written.
What if a column name is empty or repeated?
An empty name becomes column_3 and a repeated name becomes name_2, the same as the CSV to JSON conversion.
Is my data uploaded?
No. The conversion runs entirely in your browser.
Similar tools
- JSON Formatter & Syntax PrettifierFormat messy single-line JSON with 2/4-space indentation and sorted keys.
- JSON Minifier & Whitespace CompressorStrip whitespace and newlines from JSON payloads and compare byte savings.
- RFC 8259 JSON Syntax Validator & DebuggerPinpoint trailing commas, unquoted keys & syntax errors with line/column clues.
- Interactive Collapsible JSON Tree ViewerInspect nested JSON keys, data types and object counts cleanly in a collapsible tree.