CSV to SQL converter
Your csv
FAQ
Paste your CSV into the input box above. The first row is used as column names, and the tool generates a CREATE TABLE IF NOT EXISTS statement followed by one INSERT statement per data row, as you type.
For example, this CSV:
id,name
1,Ada
becomes:
CREATE TABLE IF NOT EXISTS csv_data (id TEXT, name TEXT);
INSERT INTO csv_data (id, name) VALUES ('1', 'Ada');
Every column is created as TEXT and every value is emitted as quoted text. Leading and trailing whitespace around values is trimmed. If you need numeric, date, or boolean columns, edit the types in the CREATE TABLE statement before running it, or cast the values after loading them.
Any character in a header name other than letters, digits, and underscores is replaced with _ (for example, first name becomes first_name). Headers that start with a digit, repeat another header, or match a reserved word such as order are not changed further, so rename or quote them if your database rejects them. The table is named csv_data; rename it in the output to match your database.
The output uses broadly supported CREATE TABLE IF NOT EXISTS and INSERT INTO ... VALUES syntax, so it is a starting point for SQLite, PostgreSQL, MySQL/MariaDB, and similar databases. Depending on your data and database, you may need to adjust identifiers, column types, or dialect details. Values that contain single quotes (for example, O'Brien) are not escaped yet, so double them (O''Brien) before running the SQL. To try the output without installing anything, paste it into the SQL playground.
No. The conversion runs entirely in your browser, so the CSV you paste is not sent to a server.