Preview
Seed a database in one script
Choose the fields, the dialect and the number of rows, and RNDGen writes a SQL script you can run with psql,mysql, sqlite3 or sqlcmd. Column types follow the field types, NULL stands in for blanks, and strings are escaped for the dialect.
CREATE TABLE "users" (
"id" INTEGER,
"first_name" VARCHAR(255),
"last_name" VARCHAR(255),
"email" VARCHAR(255),
"age" INTEGER,
"is_active" BOOLEAN
);
INSERT INTO "users" ("id", "first_name", "last_name", "email", "age", "is_active") VALUES
(1, 'Colton', 'Wintheiser', '[email protected]', 39, TRUE),
(2, 'Mafalda', 'Reilly-Nitzsche', '[email protected]', 35, FALSE),
(3, 'Cleve', 'Bailey', '[email protected]', 50, FALSE);What you control
- Dialect: PostgreSQL, MySQL, SQLite or SQL Server.
- Table name and whether to
DROPandCREATEit first. - Rows per INSERT, from 1 to 1,000, for fast loading.
- Related tables with real foreign keys: users, their orders and order lines in one script, parents first.
Same data every run
Keep the seed and reference date with the schema and the script is identical every time, so integration tests and demo databases start from the same state. Save the schema in your free workspace to reuse it. For files instead of a script, see the CSV, JSON and Excel generators.
FAQ
Which databases are supported?
PostgreSQL, MySQL, SQLite and SQL Server. Identifiers are quoted, column types and boolean values follow the dialect you choose.
Does the script create the table?
Yes, by default it starts with CREATE TABLE, and it can also drop an existing table first. Turn either off to insert into a table you already have.
How many rows go into one INSERT?
You choose, from 1 to 1,000 rows per statement. Batched inserts load much faster than one statement per row.
Can I seed several tables with foreign keys?
Yes, with related tables on a free account. The INSERT statements come in dependency order, parents first, and every foreign key points to a row that exists.
Is it safe to run on my database?
Values are escaped for the chosen dialect, and the script only touches the table it names. Still, run seed data on development and test databases, not production.