Skip to content
faker.tools
All 79

Plate IV · Developer, API & Database Seeding Utilities

SQL INSERT Statement Generator

Ready-to-run seed scripts for PostgreSQL, MySQL, SQLite and SQL Server, with dialect-correct types and literals.

sql
CREATE TABLE "users" (
  "id" INTEGER PRIMARY KEY,
  "fullName" VARCHAR(128),
  "email" VARCHAR(255),
  "city" VARCHAR(96),
  "isActive" BOOLEAN,
  "createdAt" TIMESTAMPTZ
);

INSERT INTO "users" ("id", "fullName", "email", "city", "isActive", "createdAt") VALUES
  (1, 'Alice Young', 'alice.young@example.com', 'Boise', TRUE, '2026-01-30T23:11:06Z'),
  (2, 'Ryan Lopez', 'ryan.lopez@example.com', 'Brooklyn', TRUE, '2026-04-09T23:11:06Z'),
  (3, 'Linda Anderson', 'linda.anderson@example.com', 'Savannah', FALSE, '2026-04-21T23:11:06Z'),
  (4, 'Iris Martin', 'iris.martin@example.com', 'Portland', TRUE, '2024-05-09T23:11:06Z'),
  (5, 'Thomas Moore', 'thomas.moore@example.com', 'Boise', TRUE, '2025-08-04T23:11:06Z'),
  (6, 'Patricia Smith', 'patricia.smith@example.com', 'Portland', TRUE, '2026-03-12T23:11:06Z'),
  (7, 'Margaret Garcia', 'margaret.garcia@example.com', 'Boise', FALSE, '2026-06-18T23:11:06Z'),
  (8, 'Elijah Williams', 'elijah.williams@example.com', 'Austin', FALSE, '2026-07-13T23:11:06Z'),
  (9, 'Jason Hill', 'jason.hill@example.com', 'Savannah', TRUE, '2026-08-25T23:11:06Z'),
  (10, 'Jason Davis', 'jason.davis@example.com', 'Savannah', TRUE, '2026-01-08T23:11:06Z');
20 lines · 1.2 KBGenerated in your browser · SQL INSERT Statement Generator

A SQL INSERT generator turns fake records into a seed script you can run straight against your database. Pick the columns, choose PostgreSQL, MySQL, SQLite or SQL Server, and you get an optional CREATE TABLE, correctly quoted identifiers, and literals each engine accepts — so psql -f seed.sql works the first time instead of failing on row 1 with a type error.

The dialect differences are the whole job. T-SQL has no TRUE, MySQL's JSON column rejects a Postgres array literal, and neither MySQL nor SQL Server takes a timestamp ending in Z. A 1,500-row script with every field type loads cleanly into PostgreSQL 16, MySQL 8.4, SQL Server 2022 and SQLite 3.

How to use it

  1. Tick the columns. Each row is one coherent imaginary person, so fullName, email and username match.
  2. Set the table name and pick a dialect.
  3. Choose options: include CREATE TABLE, write one multi-row INSERT or one statement per row, wrap everything in a transaction, and truncate the table first.
  4. Set the row count (up to 2,000), download the .sql file and run it.
psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -f seed.sql          # PostgreSQL
mysql -u root -p app_dev < seed.sql                          # MySQL / MariaDB
sqlite3 dev.db < seed.sql                                    # SQLite
sqlcmd -S localhost -U sa -C -b -i seed.sql                  # SQL Server

What you can control

  • Four dialects with the right identifier quotes: "double" for PostgreSQL and SQLite, `backticks` for MySQL, [brackets] for SQL Server.
  • Per-dialect column types — TIMESTAMPTZ, DATETIME, DATETIME2 or TEXT; UUID, CHAR(36) or UNIQUEIDENTIFIER; BOOLEAN, BIT or INTEGER.
  • Per-dialect literals for booleans, arrays and timestamps, and N'…' strings for SQL Server.
  • Multi-row INSERTs split into batches of 1,000, or one statement per row.
  • An optional transaction wrapper and TRUNCATE (or DELETE FROM on SQLite).
  • Thirty-three field types, from ids and UUIDs to prices, scores, tags and timestamps.

What the dialects disagree on

PostgreSQL MySQL SQLite SQL Server
Boolean literal TRUE TRUE 1 1
Array of tags '{a,b}' into TEXT[] '["a","b"]' into JSON JSON text JSON text in NVARCHAR(MAX)
Timestamp '2026-03-22T22:19:14Z' '2026-03-22 22:19:14' ISO text '2026-03-22 22:19:14'
Unicode strings 'Zoë' 'Zoë' 'Zoë' N'Zoë'
Rows per VALUES no limit max_allowed_packet no fixed limit 1,000

Testing ideas

  • Run it in CI. Start a database container, load the seed, then run your integration tests against it. Keep ON_ERROR_STOP (or -b for sqlcmd) on so a bad row fails the build instead of being skipped.
  • Apostrophes and Unicode. Names like O'Brien and Zoë are where hand-written seed scripts break. Generate a few hundred rows and grep for '' to confirm escaping.
  • Volume. 2,000 rows is enough to make an unindexed query visibly slow. Generate several batches with different seeds for more.
  • Idempotency. Turn on truncate and the transaction wrapper, and run the script twice. The row count should be the same both times.

What this is not

This writes data, not migrations. It will not add foreign keys, indexes or constraints beyond the primary key, and the CREATE TABLE is a convenience for scratch databases. For schemas with relationships, read How to seed a database with fake data.

Questions

Which databases does the output run on?

PostgreSQL, MySQL, SQLite and SQL Server. A 1,500-row script with every field type was loaded into PostgreSQL 16, MySQL 8.4, SQL Server 2022 and SQLite 3 without errors. MariaDB accepts the MySQL dialect.

How are booleans, arrays and timestamps written per dialect?

Booleans are TRUE/FALSE for PostgreSQL and MySQL and 1/0 for SQL Server and SQLite. The tags array becomes a native text[] literal in PostgreSQL and a JSON array elsewhere. Timestamps keep their ISO 8601 Z suffix for PostgreSQL's TIMESTAMPTZ and SQLite, and become YYYY-MM-DD HH:MM:SS for MySQL DATETIME and SQL Server DATETIME2.

Why are large scripts split into several INSERT statements?

SQL Server rejects a VALUES list longer than 1,000 rows. The generator splits multi-row inserts into batches of 1,000 for every dialect, which also keeps individual statements small enough for most clients.

Does it escape quotes in names like O'Brien?

Yes. Single quotes are doubled inside string literals, and SQL Server strings get the N prefix so non-Latin characters survive.

Can I add foreign keys between tables?

Generate each table separately with the same seed and an integer id column, then insert parents before children. The guide on seeding a database with fake data walks through ordering and referential integrity.

Next in Developer

All 11 →