CSV → SQL

CSV to SQL

CSV to SQL generates CREATE TABLE and INSERT statements from CSV rows. Choose a database dialect, infer column types or keep text, and review the SQL before using it.

Drop a file or paste below
Conversion options

Ready

SQL column type inference

Inference examines all nonempty values in a column. Boolean columns use BOOLEAN or SQLite INTEGER, integer columns use BIGINT, and decimal columns use a dialect-specific numeric type. A leading-zero identifier such as 007 remains text. Mixed types become TEXT. Choose text-only columns when identifiers, exact formatting or downstream import rules matter more than inferred numeric types.

Quoted names and escaped SQL values

Identifiers use double quotes for PostgreSQL and SQLite, and backticks for MySQL. Embedded identifier quotes are doubled. Text apostrophes are doubled, so O'Brien becomes O''Brien inside a string literal; MySQL backslashes are escaped as well. Table names with dots are treated as separate quoted name components. The result is generated SQL text, not a connection to a database.

Empty cells, headers and CSV quoting

The first row normally supplies column names; without a header, names become column_1 and onward. Empty-as-NULL is optional. Turning it off preserves empty strings. Duplicate or empty headers receive distinct names. Rows with inconsistent column counts are rejected so a delimiter error cannot shift values into the wrong SQL columns.

Format references

PostgreSQL SQL syntax · SQLite data types · MySQL string literals

File content is read and converted in the browser. Conversion does not upload the source to a server.

Frequently asked questions

Is SQL executed automatically?

No. You receive editable SQL text for review and download.

Can empty cells stay empty strings?

Yes. Turn off Empty cells as NULL.