Convert CSV to SQL
Generate CREATE TABLE and INSERT statements from CSV for multiple SQL dialects.
**CSV to SQL conversion** is the process of transforming Comma-Separated Values data into Structured Query Language statements for importing tabular data into relational databases. SQL is the standard language for managing data in relational database management systems, as defined by the ISO/IEC 9075 standard. This tool produces CREATE TABLE statements (with appropriate data type inference) and INSERT statements from CSV data. It supports four SQL dialects: MySQL, PostgreSQL, SQLite, and Microsoft SQL Server, each with their specific syntax for string quoting, NULL handling, and data types. You can configure a table name, choose the batch size for INSERT statements (100, 500, 1000, or 5000 rows per statement), and toggle whether to generate the CREATE TABLE header. The parser infers column data types by analyzing the first 100 rows: columns containing only integers become INTEGER, decimal numbers become REAL/VARCHAR, and everything else becomes VARCHAR/TEXT. The output includes proper escaping for single quotes and backslashes, and handles NULL values correctly. All processing runs locally in your browser, which is critical because CSV data being converted to SQL often contains sensitive records.
How to use the Convert CSV to SQL tool
- Load your CSV data: Drag and drop your CSV file, choose a file from your file explorer, or paste CSV data directly into the paste area.
- Configure SQL output: Enter a table name, choose a SQL dialect (MySQL, PostgreSQL, SQLite, or MSSQL), and toggle whether to generate a CREATE TABLE statement.
- Set input options: Select the input delimiter, toggle header row, and choose a batch size for INSERT statements (100, 500, 1000, or 5000 rows).
- Convert to SQL: Click the "Convert Data" button to generate CREATE TABLE and INSERT statements from your CSV.
- Export results: Copy the SQL output to your clipboard or download it as a file.