Fake Data Generator · Tutorial

How to fill a test database with fake orders

7 min readbeginnerUpdated

An empty development database makes it hard to test reports, pagination and search. You will define an orders table, generate 20 rows of believable data as SQL, and load them, all without copying any real customer data.

What you need

Steps

  1. Describe the columns

    Add one field per column: order_id as Row number, customer as Full name, product as Product name, quantity as Whole number with range 1-5, price as Price with 5-250, paid as True / false, and ordered_at as Date and time with 2026-01-01 to 2026-10-31.

  2. Choose SQL output

    Set Format to SQL INSERT, pick your Database and type orders as the table name. The output starts with a CREATE TABLE statement whose types match the data.

    CREATE TABLE "orders" (
      "order_id" integer NOT NULL,
      "customer" text NOT NULL,
      ...
    );
  3. Set the number of rows

    Start with 20 rows to check the result, then raise it to a few thousand to test pagination and slow queries.

  4. Load it into the database

    Download the file and run it with your database client, for example psql -d dev -f test-data.sql or sqlite3 dev.db < test-data.sql.

  5. Keep the seed

    Write the seed into your project’s README. Anyone on the team can generate exactly the same rows, so bug reports like “order 17 shows the wrong total” mean the same order for everyone.

Try it yourself

Opens the Fake Data Generator with this tutorial's sample loaded.

Try it now

Common mistakes

Running it against a database that already has the table
The CREATE TABLE statement fails if orders already exists. Drop the test table first, or delete the CREATE TABLE part and keep only the INSERT statements.
Expecting related rows to match
Each table is generated on its own, so customer names in orders won’t match a separate customers table. For foreign keys, use Row number fields and a Whole number range that matches the other table’s IDs.

Next steps

Go back to the Fake Data Generator, or keep going with one of these:

FAQ

Can I generate data for several tables?

Yes. Generate each table separately with its own fields and table name, then run the files in order.