SQL INSERT Generator

Runs in browser Database

Define columns and rows (or paste CSV/JSON) and produce single or multi-row INSERT statements with correct quoting for MySQL, PostgreSQL, SQL Server, Oracle or SQLite. Also supports generated test rows.

Privacy: This tool runs entirely in your browser. Your input never leaves your device.
Loading tool…

What is SQL, and why does the dialect matter?

SQL is the query language of relational databases, standardised in outline but implemented with dialect differences — quoting rules, functions, LIMIT versus TOP, date literals — by PostgreSQL, MySQL, SQLite, SQL Server and Oracle. A formatter normalises keywords, indentation and line breaks so a long query can be read and reviewed; a validator parses the statement to find syntax errors before it reaches the database.

Security note: Generated INSERT or IN-clause statements are for fixtures and migrations. In application code, values must go through parameterised queries — building SQL from user input by string concatenation is how SQL injection happens.

How to use SQL INSERT Generator

  1. Paste rows (first line = column names) or a JSON array.
  2. Enter the table name and choose the dialect and statement style.
  3. Copy the generated INSERT statements.

SQL INSERT Generator features

  • Accepts CSV/TSV with header or a JSON array of objects
  • Automatic column type inference for correct quoting (numbers, booleans, dates, NULL)
  • Multi-row INSERT with batching, or one statement per row
  • MySQL, PostgreSQL, SQL Server, Oracle (INSERT ALL) and SQLite syntax
  • Identifier quoting: only when needed, always or never
  • Optional transaction wrapper

SQL INSERT Generator example

Two rows to a multi-row INSERT

Input:

id,name,active
1,Layla,true
2,Omar,false

Output:

INSERT INTO users (id, name, active) VALUES
  (1, 'Layla', 1),
  (2, 'Omar', 0);

Frequently asked questions about SQL INSERT Generator

What input formats are accepted?

CSV or TSV with a header row (comma, semicolon, tab or pipe delimited — detected automatically) and JSON arrays of objects. Nested JSON objects are flattened into column_subcolumn names.

How are values quoted?

Column types are inferred from the data: numbers stay unquoted, booleans become TRUE/FALSE or 1/0 depending on the dialect, empty cells and NULL become NULL, and everything else is single-quoted with quotes escaped. Tick "Quote every value as text" to disable inference.

Why are rows batched?

Large multi-row INSERTs can exceed packet or parameter limits. SQL Server allows at most 1000 rows per INSERT … VALUES; the batch size splits the rows into several statements. Oracle uses INSERT ALL syntax automatically.

Can I generate seed data without a file?

Yes — type a small CSV by hand, or use the Test Data tools to generate a CSV and paste it here.

Technical notes

Column headers are normalised into identifiers: NFKD decomposition strips diacritics, camelCase is split, anything outside [A-Za-z0-9_] becomes an underscore, a leading digit gets a _ prefix, then everything is lower-cased and cut at 63 characters (PostgreSQL's limit). Auto quoting applies only when a name fails ^[A-Za-z_][A-Za-z0-9_]*$ or is a reserved word — backticks for MySQL, [brackets] for SQL Server, double quotes elsewhere, dotted names per part. The table name is quoted but never rewritten.

Per-column inference merges kinds: numeric widen integer → bigint → decimal, date with datetime gives datetime, other mixes become strings. 007 stays a string, numeric literals are copied verbatim (1.50 keeps its zero), and blank, null, N/A, \N or - become NULL. TRUE/FALSE appear only in PostgreSQL, 1/0 elsewhere. Single quotes are doubled; MySQL also doubles backslashes, SQL Server N-prefixes non-ASCII text, and Oracle receives DATE '…' and TIMESTAMP '…' literals.

References

  • PostgreSQL Documentation: SQL SyntaxThe PostgreSQL Global Development GroupLexical structure of SQL in PostgreSQL: identifiers, quoting, string constants and escaping.
  • SQL As Understood By SQLiteSQLiteThe SQL grammar accepted by SQLite, statement by statement, with railroad diagrams.
  • SQL InjectionOWASP FoundationHow SQL injection works and why parameterised queries, not string building, are the defence.