CSV to SQL
Generate CREATE TABLE and INSERT statements from CSV data. Supports PostgreSQL, MySQL, SQLite, and SQL Server.
What is CSV to SQL Conversion?
Converting CSV data to SQL is one of the most common data import workflows. Instead of manually writing CREATE TABLE and INSERT statements for hundreds of rows, you paste your CSV and get ready-to-run SQL in seconds. The tool automatically infers the appropriate SQL type for each column — integers, decimals, booleans, or text.
This is useful for seeding databases during development, importing exported spreadsheet data into PostgreSQL or MySQL, migrating flat files into relational databases, and generating test fixtures. The generated SQL includes both the schema definition (CREATE TABLE) and the data (INSERT statements) in your chosen SQL dialect.
Dialect Differences
| Feature | PostgreSQL | MySQL | SQLite | SQL Server |
|---|---|---|---|---|
| Identifier quoting | "column" | `column` | "column" | [column] |
| String type | TEXT | VARCHAR(255) | TEXT | NVARCHAR(255) |
| Boolean type | BOOLEAN | BOOLEAN | BOOLEAN | BIT |
| Integer type | BIGINT | BIGINT | BIGINT | BIGINT |
Type Inference Rules
| Column values | Inferred SQL type | Example |
|---|---|---|
| All integers | BIGINT | 1, 42, 1000 |
| All decimals | DOUBLE PRECISION | 9.5, 3.14 |
| true / false only | BOOLEAN (or BIT) | true, false |
| Mixed or strings | TEXT / VARCHAR(255) | Alice, 2024-01-01 |
| Empty column | TEXT / NVARCHAR(255) | (all empty) |
Example Output (PostgreSQL)
CREATE TABLE "users" (
"name" TEXT,
"email" TEXT,
"age" BIGINT,
"active" BOOLEAN,
"score" DOUBLE PRECISION
);
INSERT INTO "users" ("name", "email", "age", "active", "score") VALUES ('Alice', 'alice@example.com', 30, TRUE, 9.5);
INSERT INTO "users" ("name", "email", "age", "active", "score") VALUES ('Bob', 'bob@example.com', 27, TRUE, 8.2);