.sql

SQL dump test files

A ready-to-load database dump in your dialect, with related tables, foreign keys and the strings that break naive escaping.

Or start from a preset

What is a SQL dump?

Short answer

A SQL dump is a text file of SQL statements that recreates tables and their data: CREATE TABLE for the structure, then INSERT statements for the rows. Tools like pg_dump and mysqldump write them, and psql, mysql or sqlite3 load them.

Dialects differ in more than types. MySQL treats a backslash inside a string as an escape, PostgreSQL and SQLite do not, and identifiers are quoted with backticks in MySQL but double quotes elsewhere. The generator writes each dialect correctly.

Anatomy of a SQL dump

  • CREATE TABLEColumns, types, primary and foreign keys
  • INSERT INTO … VALUESOne row per statement, or 500 rows per statement
  • 'O''Brien'A quote inside a string is doubled
  • BEGIN … COMMITOptional transaction around the data
  • DROP TABLE IF EXISTSOptional, so the dump can be loaded twice

What you can generate

  • PostgreSQL, MySQL (utf8mb4) or SQLite dialect
  • Foreign keys between customers, orders, products and more
  • NULLs, quotes, backslashes and Unicode in text columns
  • Reserved-word column names (order, group, select), quoted correctly
  • Single-row or multi-row INSERT statements
  • Up to 8 tables of 100,000 rows

How to make one

  1. Open the SQL dump generator, or start from a preset above.
  2. Set the size and switch on the edge cases you need; the preview and size estimate follow every change.
  3. Generate, then download. The file is made in your browser, and the same preset and seed always give you the same file.

Questions

The SQLite dumps are loaded by the tests with sqlite3 and every table and row is counted. PostgreSQL and MySQL dumps follow the same structure with each dialect's types, quoting and escaping.

MySQL reads \n inside a string as a newline unless NO_BACKSLASH_ESCAPES is set. PostgreSQL (with standard_conforming_strings on) and SQLite keep the backslash.

Yes. Every reference points at a row that exists, and SQLite's foreign_key_check finds no violations.

Related formats