Reference

SQL file (.sql)

A SQL file (`.sql`) is a plain-text file containing SQL statements — commands that create tables, insert rows, or query a database. It is commonly used to back up, transfer, or rebuild a database by running its statements in order.

Files & formatsGeneral

SQL file (.sql)

Also known as: .sql, SQL script, SQL dump

A SQL file (`.sql`) is a plain-text file containing SQL statements — commands that create tables, insert rows, or query a database. It is commonly used to back up, transfer, or rebuild a database by running its statements in order.

  • Plain text containing SQL statements
  • Used for backups, migrations, and dumps
  • Run against a database to recreate it

What a .sql file contains

A `.sql` file holds text instructions written in SQL (Structured Query Language), such as `CREATE TABLE`, `INSERT`, and `SELECT`. Running the file replays those statements against a database.

A common use is a database dump: an export of a database’s structure and data as SQL statements, so the same database can be recreated elsewhere by executing the file.

How .sql files are used

Developers and admins use SQL files to back up data, migrate between servers, version-control schema changes, or share a dataset. Because it is plain text, a `.sql` file opens in any editor, though large dumps can be very big.

Related terms

Keep reading the reference.