Loading...
Convert CSV data to SQL INSERT statements instantly. Auto-detects column types, generates CREATE TABLE, and supports MySQL, PostgreSQL, and SQLite.
CREATE TABLE users (
id INT PRIMARY KEY,
name VARCHAR(50),
email VARCHAR(50),
age INT
);
INSERT INTO users (id, name, email, age)
VALUES
(1, 'John Doe', 'john@example.com', 28),
(2, 'Jane Smith', 'jane@example.com', 34),
(3, 'Bob Wilson', 'bob@example.com', 45);// Method 1: Use generated SQL
mysql -u username -p database_name < output.sql
// Method 2: Direct CSV import
LOAD DATA INFILE '/path/data.csv' INTO TABLE table_name FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 ROWS;// Method 1: Use generated SQL
psql -U username -d database_name -f output.sql
// Method 2: Direct CSV import
COPY table_name FROM '/path/data.csv' DELIMITER ',' CSV HEADER;// Method 1: Use generated SQL
sqlite3 database.db < output.sql
// Method 2: Direct CSV import
.mode csv
.import data.csv table_namePaste your CSV data with headers in the first row. The converter parses columns, auto-detects data types (INT, VARCHAR, DECIMAL, DATE, BOOLEAN), generates a CREATE TABLE statement, and builds INSERT statements for all rows.
The generated SQL uses standard ANSI SQL syntax compatible with MySQL, PostgreSQL, SQLite, SQL Server, MariaDB, and most relational databases. Minor adjustments may be needed for dialect-specific features.
Yes. The converter analyzes all values in each column to infer types: integers become INT, numbers with decimals become DECIMAL, dates (YYYY-MM-DD) become DATE, true/false become BOOLEAN, and text becomes VARCHAR with appropriate length.
This browser-based tool works well for small to medium CSVs (up to a few thousand rows). For very large files (100K+ rows), use command-line tools like csvkit, pgloader, or MySQL's LOAD DATA INFILE for better performance.
Multi-row INSERT combines all values into one statement: INSERT INTO t VALUES (row1), (row2), (row3). Single-row generates separate INSERT statements per row. Multi-row is faster for bulk imports; single-row is safer for debugging.
Option 1: Use our converter to generate SQL, then run in MySQL Workbench or CLI. Option 2: Use LOAD DATA INFILE '/path/to/file.csv' INTO TABLE table_name FIELDS TERMINATED BY ','. Option 3: Use phpMyAdmin's import feature.
Option 1: Use generated SQL from this tool. Option 2: Use COPY table_name FROM '/path/file.csv' DELIMITER ',' CSV HEADER. Option 3: Use pgAdmin's import wizard. Option 4: Use the \copy command in psql.
Single quotes in values are escaped as '' (double single quotes) per SQL standard. The CSV parser handles quoted fields (double quotes) for values containing commas. NULL and empty values are converted to SQL NULL.
Yes. Enter your desired table name in the 'Table Name' field above. The default is 'my_table'. Use lowercase with underscores for best SQL compatibility.
Currently this tool expects comma-separated values. Replace semicolons with commas before pasting, or use a text editor's find-and-replace. Future versions may support custom delimiters.
Disclaimer: This tool generates standard SQL for reference. Always validate generated SQL before running on production databases. Back up your data first.