.SQL

SQL File

SQL Script (Structured Query Language source / database dump)
Ask a question
QUICK ANSWER

A SQL file is a plain-text file containing SQL commands - schema definitions, INSERT statements, or queries. Open it in any text editor to read it; to use it, execute it against a database in DBeaver, MySQL Workbench, or with mysql < file.sql on the command line. It is not a database itself, and running an untrusted one can be destructive.

Developer: No single owner - SQL is an ANSI/ISO standard; .sql files are produced by every RDBMS (MySQL, PostgreSQL, SQL Server, Oracle, SQLite, etc.) Category: Database Files Open standard MIME: application/sql
OPENS ON Windows macOS Linux
Related: .DB · .DBF · .ACCDB · .MDB

On this page

19k+ extensions indexed
Last reviewed Jun 25, 2026

Not sure what your file is?

Drop any file into our identifier - we read just the first bytes to name the format.

Identify a file

What is the SQL file format?

A .sql file is written in Structured Query Language (SQL) used for relational database management. The file contains database queries as SQL code, holding instructions for database operations such as insertion, deletion, update, and schema definitions (CREATE TABLE, ALTER TABLE).

.sql files use plain text format (UTF-8 or ASCII) to store data - users can open and edit file contents using any text editor. Files typically begin with a comment block (e.g. -- MySQL dump) or a keyword like CREATE or INSERT, as there is no fixed file signature. Because SQL is an ANSI/ISO standard, .sql files are supported by MySQL, PostgreSQL, SQL Server, Oracle, and SQLite, making them a universal format for database backups, migrations, and schema versioning.

Security & safety

RISK: MEDIUM

A .sql file is plain text and safe to READ. The risk is in EXECUTING it: a script can contain destructive statements (DROP/DELETE/UPDATE) or even malicious payloads, and running an untrusted dump against your database can wipe data or, in some setups, run dangerous operations. Always inspect a .sql before executing, run it against a throwaway/test database first, and keep backups. Dumps can also contain sensitive data (passwords hashes, personal data) - treat as confidential.

Format details

in a nutshell
FULL NAMESQL Script (Structured Query Language source / database dump)
DEVELOPERNo single owner - SQL is an ANSI/ISO standard; .sql files are produced by every RDBMS (MySQL, PostgreSQL, SQL Server, Oracle, SQLite, etc.)since SQL standardized by ANSI in 1986 / ISO in 1987; the .sql convention predates and accompanies it
MIME TYPEapplication/sql
TYPEPlain-text source file containing SQL statements (queries, schema definitions, and/or data INSERTs)
STANDARDOpen · royalty-free

Programs that open SQL files

Windows5 apps
Navicat Premium Paid Open and run the .sql against MySQL/PostgreSQL/Oracle/SQL Server/SQLite connections.
MySQL Workbench Open-source MySQL/MariaDB dumps: Server -> Data Import, or open the script and run it against a connection.
DBeaver Open-source Open the .sql in the SQL editor, connect to a database, and Execute Script to run it. Best free cross-engine option.
Notepad / VS Code Open-source Read/edit the SQL as text with syntax highlighting (doesn't execute it, but ideal for inspection).
MySQL (command line) Open-source Import a dump: mysql -u user -p dbname < file.sql in a terminal.
macOS3 apps
DBeaver Open-source Open the .sql, connect, Execute Script. Works across all major engines.
TablePlus Freemium Open the .sql in the SQL editor and run it against a connection; native mac UI.
Any text editor (BBEdit, VS Code) Free Read/edit the SQL as text.
Linux2 apps
DBeaver Open-source Open and execute the .sql against any JDBC database.
psql / mysql CLI Open-source Import: psql dbname -f file.sql (PostgreSQL) or mysql dbname < file.sql (MySQL).

Technical details

deep spec
MIME typeapplication/sql
EncodingUTF-8 or ASCII plain text; no binary content
File signatureNone - no magic bytes; identified by the .sql extension or content inspection
Opening patternTypically begins with a comment (-- or /* ... */) or a DDL/DML keyword such as CREATE or INSERT
Statement categoriesDDL (CREATE, ALTER, DROP), DML (INSERT, UPDATE, DELETE), DCL (GRANT, REVOKE), TCL (COMMIT, ROLLBACK)
Statement delimiterSemicolon (;) terminates individual statements
Comment syntaxSingle-line -- and block /* ... */
SQL dialect variationSyntax differs by RDBMS: ANSI SQL, T-SQL (SQL Server), PL/pgSQL (PostgreSQL), PL/SQL (Oracle)
Dump header formatDatabase exports include tool metadata comments, e.g. -- MySQL dump 10.13 or -- PostgreSQL database dump
Transaction supportScripts may wrap statements in BEGIN / COMMIT blocks for atomic execution
Character set directivesDumps often include SET NAMES utf8mb4 or equivalent declarations to specify string encoding
Typical file sizeFrom a few bytes (single query) to many gigabytes (full database exports)
Cross-RDBMS portabilityFully portable between servers of the same RDBMS; partially portable across different systems due to dialect differences
Execution methodInterpreted at runtime by the database engine; not compiled or pre-processed
Common use casesSchema migrations, database backups and restores, data seeding, bulk imports, and version-controlled schema management
ReleasedSQL standardized by ANSI in 1986 / ISO in 1987; the .sql convention predates and accompanies it
Open standardYes · royalty-free
Specificationwww.iso.org

SQL conversions

Community Q&A

asked by users
Ask a quick question
Get help from people who work with SQL files. Be specific - include your system and software version.
No account needed · answers usually within a day

No questions yet - be the first to ask about SQL files.

Frequently asked questions

How do I open a SQL file?
To read it, open it in any text editor (Notepad++, VS Code) - it's plain text. To actually use it, execute it against a database: import it in DBeaver/MySQL Workbench/phpMyAdmin, or run mysql dbname < file.sql / psql dbname -f file.sql on the command line.
How do I import a .sql dump into MySQL?
Create an empty database, then run mysql -u user -p dbname < file.sql, or use phpMyAdmin's Import tab, or MySQL Workbench's Data Import. The dump's CREATE/INSERT statements rebuild the tables and data.
Is a SQL file a database?
No. A .sql file is the text instructions (queries, schema, data) to build or change a database. The database itself is a separate file (.db/.sqlite) or lives inside a server. Running the .sql creates/populates that database.
How do I convert a SQL file to CSV or Excel?
Import the .sql into a database first, then export the table(s) to CSV/Excel from a tool like DBeaver, MySQL Workbench or phpMyAdmin. There's no direct file-to-file converter because a dump contains schema and statements, not just rows.
Why won't my .sql import - it gives syntax errors?
Usually a dialect mismatch: a dump made for MySQL won't import unchanged into PostgreSQL or SQLite (different keywords like AUTO_INCREMENT, backticks, engine clauses). Import it into the same engine it came from, or adapt the script.
Can I open a .sql file on a Mac?
Yes - read it in any text editor, or run it with DBeaver/TablePlus or the psql/mysql command-line clients. The format is cross-platform plain text.

References

1ISO/IEC 9075 - SQL standardwww.iso.org
2MySQL - mysqldump / restoring a dumpdev.mysql.com

Keep exploring

across the database

Top extensions this week

1.AQQAQQ Instant Messenger File
2.CRDOWNLOADChrome Partial Download File
3.DATProgram Data File (generic)
4.JPGJPEG Image
5.RPMSGRestricted Permission Message
6.EXEWindows Executable (Portable Executable)
7.ICSiCalendar data file
8.PARTPartial Download File
9.JSONJavaScript Object Notation file
10.BINCD/DVD Disc Image (BIN/CUE)

Related extensions

.DBSQLite Database File
.DBFDatabase File (dBASE / xBase table)
.ACCDBMicrosoft Access Database (2007+)
.MDBMicrosoft Access Database (97-2003, Jet engine)
.FDBFirebird Database
.SQLITESQLite Database

Free file tools

An in-browser file identifier and image converter - everything runs on your device.

Open the toolbox

Browse file extensions A-Z