Free SQL test files and sample generator

Plain-text database scripts and dumps. Used for schema definitions, seed data and migrations.

Generate a .sql file →

What is a .sql file?

SQL: Structured Query Language Dump. A .sql file is a script of statements, schema definitions, inserts, or queries, used for migrations, seeding and backups. Running one is a state change, which makes a realistic sample valuable for rehearsing imports safely.

Why generate a test SQL file?

What you can put inside a .sql file

You get 3 content options for SQL, so the file holds something meaningful rather than random padding: Schema (CREATE), Schema + rows, Queries (SELECT). Pick several and they are merged into one file, with a section, sheet, slide or folder for each.

How a .sql file is identified

A .sql file has no signature at the start. A text format has no identifying leading bytes, so the extension and the reported media type are the only claims about it until a parser actually reads it, which is why validating uploads by extension alone is unsafe.

How the size lands on the exact byte

The format allows comments, so the padding is comment lines, legal, inert, and visible if you open the file.

Negative testing with broken SQL files

Which failure to reach for, and what to assert for each, is covered in how to make a corrupted file for testing. For upload limits and type checks see testing file upload validation, and for this format's encodings, UTF-16 and BOM test files.

Sample SQL content

INSERT INTO users (id, name) VALUES
  (1, 'Test User'),
  (2, 'Jane Doe');

This shows the shape of the file. Your download is generated fresh at the size you choose, so the values will differ.

How to open and verify the file

Run against a scratch database with `sqlite3 test.db < file.sql`, `psql -f file.sql`, or `mysql < file.sql`.

Media type application/sql · extension .sql · category Data

Generate a .sql file → · questions about sizes, privacy or cost are answered on the site FAQ.

Frequently asked questions about SQL files

What identifies a .sql file?

Nothing at the start of the file does. A text format has no identifying leading bytes, so the extension and the reported media type are the only claims about it until a parser actually reads it, which is why validating uploads by extension alone is unsafe.

How can a .sql file be an exact number of bytes?

The format allows comments, so the padding is comment lines, legal, inert, and visible if you open the file.

What can go inside the SQL file?

There are 3 content options for .sql: Schema (CREATE), Schema + rows, Queries (SELECT). Choose more than one and they are combined into a single file, a section, sheet, slide or folder per option, rather than downloaded separately.

Can I download several broken SQL files at once?

Yes, select more than one File Condition and you get one ZIP containing a .sql per condition, each named after its condition.

Can the SQL file use UTF-16 or a byte-order mark?

Yes. .sql is a text format, so it can be generated as UTF-8, UTF-8 with a byte-order mark, UTF-16 LE or UTF-16 BE. The body is shortened before re-encoding so the finished file still lands on the exact size you asked for. Note that a UTF-16 file always has an even byte count.

How do I open or verify the SQL file?

Run against a scratch database with sqlite3 test.db < file.sql, psql -f file.sql, or mysql < file.sql.

Related Data formats

CSV · JSON · XLSX · XML · TSV · YAML · JSONL · XLS

Browse all file formats →