Free SQL sample files
A text file of SQL statements, used for database dumps, migrations and seed data. Download valid SQL test files in 6 exact sizes, from 1 KB to 10 MB, each with a checksum.
- Extension
- .sql
- MIME type
- application/sql
- Kind
- Text
- Category
- Database
SQL files by size
Every file below is a valid SQL script file of exactly the stated size. Open a file's page for its checksum and contents, and to preview it in your browser before downloading.
| File | Size | Contents | Download |
|---|---|---|---|
| 1 KB SQL samplesample-sql-1kb.sql | 1 KB1,024 bytes | Statements: 1 CREATE TABLE, 2 INSERT | Download SQL |
| 10 KB SQL samplesample-sql-10kb.sql | 10 KB10,240 bytes | Statements: 1 CREATE TABLE, 44 INSERT | Download SQL |
| 100 KB SQL samplesample-sql-100kb.sql | 100 KB102,400 bytes | Statements: 1 CREATE TABLE, 456 INSERT | Download SQL |
| 1 MB SQL samplesample-sql-1mb.sql | 1 MB1,048,576 bytes | Statements: 1 CREATE TABLE, 4,652 INSERT | Download SQL |
| 5 MB SQL samplesample-sql-5mb.sql | 5 MB5,242,880 bytes | Statements: 1 CREATE TABLE, 23,108 INSERT | Download SQL |
| 10 MB SQL samplesample-sql-10mb.sql | 10 MB10,485,760 bytes | Statements: 1 CREATE TABLE, 46,125 INSERT | Download SQL |
More SQL samples
Hand-designed files with realistic content or a specific edge case.
| File | Size | Contents | Download |
|---|---|---|---|
| Sample customers SQL script (100 rows)sample-customers.sql | 19.3 KB19,777 bytes | Statements: 1 CREATE TABLE, 100 INSERT | Download SQL |
What is an SQL file?
A .sql file is a list of statements for a database to execute in order: creating tables, inserting rows or changing a schema. Database dump tools produce them, and migration tools consume them.
SQL is standardised, but every database has its own dialect. A script written for one engine often needs changes for another.
How to recognise an SQL file
No signature bytes. SQL files are identified by parsing their content.
| Extension | .sql |
|---|---|
| MIME type | application/sql |
| Standard | ISO/IEC 9075 |
| Statement separator | Semicolon |
| Comments | -- to end of line, or /* */ |
| Encoding | Usually UTF-8 |
What to test for
These are the behaviours that most often go wrong when software handles SQL files.
- Executing an uploaded SQL file is running code. Only do it in an isolated database with a restricted account.
- Clients that load the whole script into memory struggle with large dumps; streaming execution matters at 10 MB and above.
Strengths of SQL
- Runs directly in a database with no import tool.
- Carries the schema and the data together.
Limitations of SQL
- Dialects differ, so a script written for one engine may fail on another.
- Row-by-row INSERT statements are slow for large volumes.
Typical uses of SQL test files
- Seeding development and test databases
- Testing import features in database tools
- Checking migration runners with large scripts
Software that opens SQL
- psql, mysql and sqlite3 command-line clients
- DBeaver, DataGrip and pgAdmin
- Flyway, Liquibase and other migration tools
Specifications
Related
SQL sample files: questions
- Which databases can run the sample scripts?
- They use portable syntax and have been run on SQLite. PostgreSQL, MySQL and MariaDB accept the same statements.
- What is the MIME type of an SQL file?
- The MIME type is application/sql. The file extension is .sql.
- Is a sample SQL file the same as a dummy or example SQL file?
- Yes. Sample, test, dummy and example SQL files are different names for the same thing: an SQL file with known contents that stands in for a real one. Any file on this page will do wherever a tutorial or a test plan asks for a dummy SQL file.