SQL Table Generator
Fill in the grid and copy one SQL INSERT statement per row into your database console or a migration script.
- Markdown table generator
- HTML table generator
- CSV table generator
- LaTeX table generator
- JSON table generator
- MediaWiki table generator
- Plain Text table generator
- reStructuredText table generator
- Balsamiq table generator
- Mathematica table generator
- Typst table generator
- YAML table generator
- AsciiDoc table generator
How to create your table
- Put the column names in the first row. Turn on Headers › Header row so the first row becomes the header.
- Type or paste the data rows below it.
- Choose your database under Database in the output panel menu (⋮): Standard (PostgreSQL, SQLite), MySQL / MariaDB, SQL Server or Oracle.
- Copy the statements and replace
table_namewith the name of your table.
Example output
INSERT INTO table_name (item, qty, price) VALUES ('Widget', '4', '3.00');
INSERT INTO table_name (item, qty, price) VALUES ('Gadget', '12', '5.50');
What an INSERT statement contains
INSERT INTO table_name (item, qty) VALUES ('Widget', '4'); names the table, lists the columns, and gives one value per column in the same order.
The generator takes the column names from the header row and writes one statement per data row. The table name is always table_name; replace it with the name of your table after you copy. The table must already exist, so run your CREATE TABLE statement first.
Databases
Choose Database in the output panel menu (⋮). Standard is for PostgreSQL and SQLite. MySQL / MariaDB also escapes backslashes and line breaks with a backslash. SQL Server writes strings as N'...', so characters outside the database's code page are kept. Oracle writes line breaks and & as CHR(10) and CHR(38), because SQL*Plus and SQL Developer read &name as a substitution variable.
The output of each setting is tested by running it in the database and reading the rows back: PostgreSQL, SQLite, MySQL 8.4, MariaDB 11.4, SQL Server 2022 and Oracle 23.
One INSERT per row
Each data row gets its own INSERT statement. The generator does not write a multi-row INSERT ... VALUES (...), (...). With Pretty print off (View › Output), the statements are written on one line, separated by spaces.
Types, strings and NULL
Every value is written as a quoted string, numbers included: '4'. Checkbox cells are the exception: TRUE or FALSE (1 or 0 in SQL Server). A single quote inside a value is written twice, as in 'O''Brien'. Number formats are not applied, so a cell that shows $1,234.50 because of its currency format is written as the number you typed.
An empty cell is written as an empty string (''), not as NULL, except in Oracle, which stores '' as NULL. If a column should hold NULL for empty cells, change those values after you copy.
What the editor can do
- Merge and split cells
- Paste cells from Excel, Google Sheets or an HTML table
- Import CSV, TSV, Excel (
.xlsx), OpenDocument (.ods), Markdown, HTML, LaTeX, Typst, JSON, MediaWiki and plain text tables - Copy the table as one of 14 text formats, or download it as an Excel, OpenDocument or Word (
.docx) file - Header rows and columns, borders, and bold, italic and alignment per cell
- Number formats for numbers, percentages and currencies
- Checkboxes, and one link per cell. Links stay links in Markdown, HTML, LaTeX, Typst, Excel, Word and the other formats that have them
- Sort, transpose, fill down or right, and find and replace with regular expressions
- Undo and redo, keyboard shortcuts and a command palette (
Alt+Q) - Save tables in the browser, reopen recent tables and share a table as a link
- Also available as a Windows app
Table Editor for Windows
The same editor as a Windows app, with what a browser tab can't do.
- Tabs. Keep several tables open at once. Tabs with unsaved changes come back when you start the app again.
- Your own files. Open Excel, CSV, Markdown, LaTeX and other files directly, also from Windows Explorer, and save back to the same file.
- Offline, without ads. Works without an internet connection. No ads, no analytics, and nothing leaves your computer.
A one-time purchase in the Microsoft Store.
Frequently asked questions
- Can I convert a CSV file into SQL INSERT statements?
- Yes. Open the
.csvfile with File › Import, or paste the CSV text there. Use Row › Set first row as header so the column names come from the file, choose your database under Database in the output panel menu (⋮), and copy the statements. Replacetable_namewith the name of your table. - What does the generator create?
- One
INSERT INTO table_name (...) VALUES (...);statement per data row. It does not create the table, so run yourCREATE TABLEstatement first. - How are the column names made?
- Header cells are lowercased, and characters other than letters, digits and underscores become
_. A name that starts with a digit gets acol_prefix, and a reserved word such asorderorselectgets_added. The Database setting adds the reserved words of SQL Server or Oracle, shortens names to the length MySQL (64), SQL Server or Oracle (128) accepts, and gives Oracle names that start with_acol_prefix. Without a header row, the columns are namedcolumn1,column2and so on. - How are values quoted?
- Every value is written as a string in single quotes, and a single quote inside a value is written twice (
''). For MySQL / MariaDB, backslashes and line breaks are also escaped (\\,\n), which assumes the default SQL mode (withoutNO_BACKSLASH_ESCAPES). For SQL Server, strings are written asN'...'and line breaks asNCHAR(10). For Oracle, line breaks and&are written asCHR(10)andCHR(38), and an empty cell is stored as NULL, because Oracle treats''as NULL. The databases convert quoted numbers to the column's type when they insert them. A checkbox cell is written asTRUEorFALSE, and as1or0for SQL Server, which has no boolean literal. Oracle readsTRUEandFALSEfrom version 23ai; for older versions, change them to1and0.