How the SQL Mock Data Generator works
Each column row becomes a column in the table. The generator uses the same data engine as the Fake JSON Data
Generator: names, companies and job titles come from built-in lists, town names are made up, emails use
example.com and example.org, phone numbers use the fictional 555-01xx range and IP
addresses come from the documentation ranges. Name, email and username columns in one row describe the same person.
Table and column names are always quoted for the chosen database: [brackets] for SQL Server,
"double quotes" for PostgreSQL and `backticks` for MySQL. A name such as
dbo.Customers is quoted part by part. Text is written as string literals with single quotes doubled,
booleans become 1/0 on SQL Server and TRUE/FALSE elsewhere, and
date-times are written as 'YYYY-MM-DD hh:mm:ss'. Rows are grouped into multi-row
INSERT ... VALUES statements; SQL Server accepts at most 1,000 rows per statement, so that is the limit.
The optional CREATE TABLE picks a column type for each field, for example UNIQUEIDENTIFIER,
UUID or CHAR(36) for UUIDs, and makes the first ID column the primary key.
How to use the SQL Mock Data Generator
- Review the example columns. Change a column name or type, select Add field for a new column, or select Remove to delete one. Use the Setting box for ranges (such as 1..100) and lists of values.
- Enter the table name, for example customers or dbo.Customers, and choose SQL Server, PostgreSQL or MySQL.
- Set the number of rows (1 to 1,000) and the rows per INSERT statement. Untick Include CREATE TABLE if the table already exists.
- The SQL updates as you edit. Select Generate SQL, or press Ctrl + Enter (Cmd + Enter on a Mac), for a new set of values.
- Copy the script or download it as a .sql file and run it against your development database.
Example
Columns id (ID), full_name (Full name), is_active (Boolean) and joined (Date and time), 3 rows, 2 rows per INSERT, SQL Server:
CREATE TABLE [customers] (
[id] INT NOT NULL PRIMARY KEY,
[full_name] NVARCHAR(100) NOT NULL,
[is_active] BIT NOT NULL,
[joined] DATETIME2(0) NOT NULL
);
INSERT INTO [customers] ([id], [full_name], [is_active], [joined]) VALUES
(1, 'Nadia Okafor', 1, '2022-06-14 08:41:09'),
(2, 'Hugo Varga', 0, '2024-01-30 17:05:52');
INSERT INTO [customers] ([id], [full_name], [is_active], [joined]) VALUES
(3, 'Priya Novak', 1, '2021-11-02 12:27:44');
For PostgreSQL the same columns are created as "id" INTEGER, "full_name" VARCHAR(100), "is_active" BOOLEAN and "joined" TIMESTAMP.
Common use cases
- Seeding a local or test database with realistic customers, orders or users.
- Creating enough rows to test paging, sorting, search and reports.
- Writing repeatable demo data scripts for a new feature or a bug reproduction.
- Trying out a table design with a quick CREATE TABLE and sample rows before writing migrations.
Common errors and how to fix them
- Enter a table name, or add at least one field
- Both are required before any statement can be produced: the table name becomes the INSERT target, and the fields become its column list. Use the same table name as the real table you are loading.
- The generated INSERT statements fail against my table
- The generator does not know your real schema. Match each field's type to the column type, and make sure every NOT NULL column without a default is included.
- Generated rows collide with existing primary keys
- Random values can repeat keys that are already stored. Load into an empty table, or leave identity and auto-increment columns out of the insert so the database assigns them.
- The data must not reach production
- These are randomly generated placeholder rows. Always run generated SQL against a development or test database first, and keep a backup.
Frequently asked questions
Which databases are supported?
SQL Server, PostgreSQL and MySQL. Names are quoted with [brackets], "double quotes" or `backticks` respectively, and booleans are written as 1/0 for SQL Server and TRUE/FALSE for PostgreSQL and MySQL.
Why is there a limit of 1,000 rows per INSERT?
SQL Server allows at most 1,000 rows in one INSERT ... VALUES statement. The script splits the rows into statements of the size you choose, so larger scripts run without errors. Smaller batches also make errors easier to locate.
Which column types does CREATE TABLE use?
Types are chosen per database: for example INT, NVARCHAR(100), BIT, DATE, DATETIME2(0), DECIMAL and UNIQUEIDENTIFIER on SQL Server; INTEGER, VARCHAR, BOOLEAN, TIMESTAMP, NUMERIC and UUID on PostgreSQL; and INT, VARCHAR, BOOLEAN, DATETIME, DECIMAL and CHAR(36) on MySQL. Integer columns with a range beyond 32 bits use BIGINT, and the first ID column is the primary key.
Is the data real?
No. Names are combined from built-in lists, towns and companies are invented, emails use example.com and example.org, phone numbers use the fictional 555-01xx range and IP addresses come from documentation ranges.
Are special characters escaped?
Yes. Single quotes in values are doubled, MySQL backslashes are escaped, and quote characters in table or column names are doubled inside the identifier quotes.