Skip to content
OddsockLocal
Local
Source text
Table namerecords
ReadyRuns in this browser. Nothing is uploaded.

How to use

  1. Set Table name. The default is records.
  2. Paste a JSON array of objects, one object per row.
  3. Read a single INSERT. Extra objects become extra tuples.
  4. Edit the double quotes if the database does not accept them as identifiers.

What is SQL INSERT builder?

The INSERT builder writes one batched statement from rows you describe as JSON. [{"sku":"NB-1","qty":12}] and table name stock becomes INSERT INTO "stock" ("sku", "qty") VALUES\n('NB-1', 12);. Add more objects and they become more tuples in the same statement, separated by commas. That is the batch: one INSERT, many VALUES, not a file of separate statements.

Read more

The SQL is the same shape JSON to SQL produces, because both pages share that writer. The difference is the job. Open this page when you are seeding a table that already exists and you are typing the rows. Open JSON to SQL when a payload arrived as an array and you want it loaded. Open CSV to SQL when you also need CREATE TABLE and a type for each column. None of the three has a control for PostgreSQL versus MySQL versus SQL Server. Identifiers are double-quoted. Strings use single quotes with embedded quotes doubled.

Table name defaults to records. Change it to stock, or whatever the table is called. An empty array, a non-array, or a blank table name fails.

Use cases

  • A migration needs one INSERT with a handful of seed rows, and you would rather edit JSON than quote SQL by hand.
  • sku NB-1 and qty 12 should be a string and a number in the VALUES list, not two strings.
  • You already created the table, so a generated CREATE TABLE would be a mistake.
  • Several rows should share one statement so a single transaction wraps the batch.

One seed row in stock

Table name stock. [{"sku":"NB-1","qty":12}]

INSERT INTO "stock" ("sku", "qty") VALUES\n('NB-1', 12);

Why use Oddsock

One statement for many rows is the batch. Separate INSERT lines would be a different file, and this page does not emit them.

Related tools

Using this tool

The statement is the same shape. Use this page to type seed rows. Use JSON to SQL when the array is a document you already have. Neither writes CREATE TABLE.