Skip to content
ToolMug

SQL Playground

Write SQL without installing a database. Sample employee and department tables are loaded so you can practise SELECT, JOIN, GROUP BY, subqueries and window functions, or open your own SQLite file, query it and download it again.

Runs in your browser — nothing you enter is uploaded

Examples:
Ctrl+Enter / ⌘+Enter

or drop a file here

How to use

  1. Write SQL in the editor or click an example. Several statements separated by semicolons can run at once.
  2. Click Run or press Ctrl+Enter (⌘+Enter on Mac). Each query's result appears as a table.
  3. Click Reset sample data to start over, or open a .db or .sqlite file to work with your own data.
  4. Click Download database to save the current database as a SQLite file.

Options explained

Sample data
Two tables, departments and employees (with salary and hire date). One employee has no department, for practising LEFT JOIN and NULL.
SQL dialect
SQLite 3, with CTEs (WITH), window functions, JSON functions and UPSERT. Mostly the same as MySQL and PostgreSQL; date functions and auto-increment differ.
Results
Each statement that returns rows gets its own table, up to 1,000 rows shown. INSERT, UPDATE and DELETE report how many rows changed.

Example query

-- Head count and average salary per department
SELECT d.name AS department, COUNT(*) AS people, AVG(e.salary) AS avg_salary
FROM employees e JOIN departments d ON d.id = e.department_id
GROUP BY d.name
ORDER BY avg_salary DESC;

Frequently asked questions

Is my data saved?

The database lives in this page's memory and resets to the sample data when you reload. Download the database to keep it, and open the file next time.

How large a database can I open?

The whole file is read into memory. Tens of megabytes is fine; beyond that it depends on your device's memory.

Is anything uploaded?

No. SQLite runs as WebAssembly in your browser; queries and data never leave your device.

Can it connect to a MySQL or PostgreSQL server?

No. It runs SQLite inside the browser and does not connect to any external database.

Privacy

This tool runs entirely in your browser. Your files and text are processed on your device and are never uploaded to our servers.

Related tools