A usable dataset starts as a written description of what it must prove, then becomes a schema, then becomes rows. Most people do it backwards: they generate ten thousand random records and discover later that the orders don't join to any customer. If you need linked business data for an app, a SQL exercise, an Excel report or a lesson, our test data generator with linked tables produces customers, orders and products with matching IDs, and the steps below show how to build the same thing by hand and what to check along the way.
TL;DR
- Write the question the data must answer, or the bug it must expose, before you create a single table.
- Build entities as tables with primary keys, put foreign keys on the many side, and create parent tables first.
- Generate with a seeded script so every run produces identical data, then add deliberate messiness at known positions.
- Validate with orphan counts, null checks and range checks, then export with a short documentation note.
- For reference data such as ZIP codes or occupations, use a documented dataset with source notes instead of inventing values.
Table of Contents
- Decide what the dataset has to prove
- Design tables that link correctly
- Generate the records
- Add mess on purpose
- Validate before anyone uses it
- Document, export and share
- When you need reference data, not invented data
- Where the Data Pass fits
- FAQ
- Sources
Decide what the dataset has to prove
The fastest way to waste a day is to build tables before you know what they are for. SQL Authority's advice is to write the expected query result first, then start with a tiny handwritten fixture that proves the rule. If twelve rows don't reveal the problem, a million random ones won't.
The purpose changes the shape of the data:
- Testing and demos need edge cases and stable IDs so a failing row fails every run. Customers with no orders, orders with three lines and refunded orders all belong in the set.
- Reporting and SQL practice need enough volume and variety that totals, groupings and date filters give different answers.
- Teaching needs data small enough to hold in your head and rich enough to make the point. A student should be able to predict the output of a query before running it.
For AI application evaluation, Langfuse suggests starting with roughly 15 to 30 rows that run through the application and cover the main input types, then growing into the gaps you find. DigitalOcean's guidance is similar: define scope first, write each entry to test one behavior, include normal and edge cases, and keep the dataset fixed when you compare configurations so differences come from your change.
NIST's dataset development guidelines add a habit worth copying even for small projects: keep a written description of the creation steps, because the order and timing of steps often changes which artifacts exist afterward. Two lines in a README is enough for a demo set.
Design tables that link correctly
A business dataset is usually four tables: customers, products, orders and order lines. A relational design guide states the rule plainly: each entity type becomes a table with a primary key, foreign keys sit on the many side of a one-to-many relationship, and a many-to-many relationship gets its own linking table. Here that linking table is the order lines.
Why not one wide orders sheet? Because a customer's email would repeat on every order, and a three-product order would repeat its timestamp and status three times. DataCrate360's shop capstone walks through this and shows rules like a CHECK on allowed order statuses, a composite key of order ID plus line number, a CHECK that quantity is above zero, and numeric(10,2) for money so you don't store floating-point cents.
Two details trip people up.
Creation order. Foreign keys decide which table comes first. Aalto's database course points out that enrollments can't be created before the users and course instances they reference, and the same order governs your INSERT seed data. Load children first and you get a foreign-key error.
Delete behavior. Aalto's schema implementation chapter contrasts a recipe app, where deleting a user should cascade to their recipes, with a library, where loan history must survive a member leaving, so RESTRICT fits. Decide per foreign key and write one sentence of justification. Copying the pattern from the wrong domain either blocks deletions or silently destroys history.
Put the rules in the database rather than in your import script. A script, a second app or a tired person at the console all skip application-level checks, while table constraints run on every write.
Generate the records
The common routes are a Python script, a spreadsheet, an AI assistant or a purpose-built generator. They all work if you respect one rule: generate parents first and let children pick only from the parents' real IDs.
Python with Faker and pandas
Seed the generator, build a customers DataFrame with unique IDs, then build orders that sample customer IDs from that list. One walkthrough does exactly this and finishes with an orphan-order count, which should be zero. Two files written with the same seed contain identical data, which is what makes regression tests repeatable. Seeds are per package: Python's random, Faker and NumPy each keep their own generator, so set all of them.
For a flat file, a notebook example shows Faker with csv.writer producing 1,000 rows of name, address, city, state, ZIP and coordinates, and pandas' to_csv does the same from a DataFrame.
An AI assistant
Asking a chatbot to print rows runs into its context window. OpenAI's synthetic data cookbook recommends asking it to write a Python program that generates the data, then editing and scaling that script. If you describe timeframe, products, regions, seasonality and good and bad years, as in this sales-data guide, the output has patterns worth reporting on. Review a subset before trusting it. Microsoft 365 Copilot, for its part, only writes the Python and doesn't run it, so you execute the script yourself.
A generator that already links the tables
Writing the join logic is the part that takes the time, and it is the part we built the test data generator to remove: it creates related customers, orders and products with matching IDs, and you export CSV, JSON or XML. Six reasons to use it are laid out on its own page. If your target is a database, the free SQL INSERT generator turns a CSV or JSON file into INSERT statements, and it runs in your browser without uploading the file.
For people data, the synthetic customer dataset gives you fictional names and addresses, so you never touch real personal records.
Add mess on purpose
Clean fake data only tests the happy path. The same Faker guide injects defects at seeded positions: about 3% of rows get a blank price, categories get stray spaces and mixed case, numbers are stored as text and dates appear as dd/mm/yyyy strings. Each one corresponds to a real bug report, and because the positions are seeded, the same row fails every run.
ETL Tools lists more awkward cases worth including: leap days, daylight-saving transitions, very long strings, Unicode characters, negative numbers, duplicate keys, missing reference records, trailing spaces and empty strings. Treat missing, empty and NULL as different things in each format.
Keep the mess in a labeled column or a separate file. A teaching dataset with surprise defects is a trap. A teaching dataset with a documented defect list is an exercise.

Validate before anyone uses it
Run checks right after loading, not when a report looks odd. The useful families are format and type, range, completeness, uniqueness, referential integrity and freshness or volume, as Teradata's guide lists them. Turn each into an assertion you can rerun:
- Orders with no matching customer: zero. A LEFT JOIN from orders to customers, filtered to missing customers, finds them.
- Customers with no orders: a known, intended number, since SQL Authority treats those as a deliberate edge case.
- Status values inside the allowed list.
- Order totals equal to the sum of their lines. This data quality guide frames that as a consistency assertion.
- Row counts and control totals match between source file and loaded table.
Before importing a file you've received or exported, the free CSV Inspector checks its structure, and the CSV join tool lets you match two files on a shared column to spot rows that don't pair up.
Document, export and share
Pick the format by the consumer: CSV for spreadsheets and bulk loads, JSON for APIs and front-end fixtures, XML where a legacy system demands it. The free CSV and JSON converter and CSV and XML converter move between them locally in the browser.
Ship a short note with the data. NIST says documentation should begin in the planning phase and cover the dataset's description, intended use and known limitations, the technical environment, timestamped creation steps and a maintenance plan. For a project dataset that means: what it represents, the seed, the generator version, field meanings, the injected defects and the date you built it.
If the data imitates production, anonymize consistently. One engineer hashes IDs with SHA256 so the same reseller always maps to the same anonymized ID, copies related refunds along with sampled orders, and shifts all timestamps so original records can't be identified. Fictional data avoids that work entirely.

When you need reference data, not invented data
Linked customers and orders can be made up. ZIP codes, schools, occupations, file extensions or Git commands can't, because the app's behavior depends on them being right. Inventing them is a bad idea, and so is scraping a page and hoping the columns stay consistent. Our dataset catalog offers documented reference datasets in CSV, JSON and XML with field guides, source notes and sample previews, for example file extensions or Git commands. Teachers can pull in sets like famous authors or the ancient world timeline for lessons.
Where the Data Pass fits
Free samples let you inspect any dataset before you decide. The Data Pass costs $69 once and unlocks complete datasets, the full catalog, API access and higher test-data generation limits for 365 days. It doesn't renew automatically. The e-commerce sample dataset with orders, products and customers is a ready-made starting point for reporting practice, and the Data Pass page has the details.

Worked project guides on the Made with MySafeInfo page show finished reports and tutorials built from this data.
FAQ
How many rows should a dataset have?
As few as it takes to prove the behavior. Start with a handwritten fixture of a dozen rows, then scale with a seeded script once the rules work. For AI evaluation, 15 to 30 well-chosen rows is a reasonable first set.
Can ChatGPT generate a dataset?
Yes, but ask it to write a Python script instead of listing rows, so volume isn't limited by its context window. Run the script yourself, check the output for orphans and bad values, and fix the seed so results repeat.
How do I create a dataset in Excel?
Build one sheet per entity with an ID column, then generate the data in Python with pandas and write it to a workbook with ExcelWriter, or import a CSV from a generator. Keep customer and order sheets joined by ID, and check that every order ID matches a customer.
Should test data be real or fictional?
Fictional, wherever you can. It carries no privacy risk and you control the edge cases. If you must imitate production, anonymize IDs consistently and shift dates.
Sources
- Building Your Own Sample Data Set (SQL Authority)
- Guidelines for Dataset Development (NIST)
- DigitalOcean Evaluation Dataset Design Best Practices
- Designing datasets for AI applications (Langfuse)
- Creating and populating a relational database
- Capstone 1: design the shop database (DataCrate360)
- Planning the Schema from the Design Package (Aalto OpenCS)
- Practicing Schema Implementation (Aalto OpenCS)
- Generate Realistic Excel Test Data with Faker in Python
- Synthetic Data generation (OpenAI Cookbook)
- Generating and Importing Synthetic Sales Data Using ChatGPT
- How to generate datasets with Copilot for Microsoft 365 (Stringfest Analytics)
- Chapter 3 Notebook: Road to a data engineer
- Data Validation Best Practices for Reliable ETL
- Data Validation Tools and Techniques (Teradata)
- Data quality dimensions and testing
- Prep your customer demo
