About csv to sql converter
Turn a CSV file into CREATE TABLE and INSERT statements, with column types guessed from the data.
Before you import
- Make sure the first row has clean column names.
- Check dates and decimals for the right format.
- For large files, use your database's bulk import tool instead of thousands of INSERT statements.
Back up before you run SQL
Review generated statements, run them on a test database first and keep a backup. UPDATE and DELETE without a WHERE clause affect every row. Values pasted into SQL by hand can also open the door to SQL injection, so use parameterised queries in application code.
A worked example
A CSV with the header sku,qty,price and 200 data rows becomes a CREATE TABLE statement and INSERT statements. For this many rows, a database's bulk loader (such as MySQL's LOAD DATA or PostgreSQL's COPY) is faster, but the generated SQL is handy for small files and quick tests.
