elefcode

SQL Playground

Starting PostgreSQL (first time downloads ~6 MB)…
Ctrl+Enter runs · Ctrl+/ comments

Results appear here. Everything runs in your browser — nothing is sent to a server.

Advertisement

Guide

About the SQL Playground

This playground runs an actual database engine inside your browser — PostgreSQL 18 through PGlite, or SQLite through sql.js — so queries behave exactly as they would on a server: the same functions, types, error messages and query plans. There is no server and no account; the engine downloads once (about 6 MB for PostgreSQL, 1 MB for SQLite) and the browser caches it.

Use it to try a query before running it on production, to practise SQL, to explore a CSV with real SQL, or to open a SQLite file and look inside.

Scripts run one statement at a time

PostgreSQL runs a multi-statement string as one transaction, so a single mistake would undo everything before it. The playground sends each statement separately — like psql — so when statement 5 fails, the four before it are kept and the error points to the line that caused it. Use BEGIN and COMMIT when you do want all-or-nothing.

Your data stays on your machine

Tables live in the browser tab and disappear when you close it, unless you tick “Keep in this browser”, which stores the database in IndexedDB on this device only. You can also save the whole database as a file — a .sqlite file, or a compressed PostgreSQL data directory — and open it again later.

How to use it

  1. 1Pick PostgreSQL or SQLite and wait for the engine to start.
  2. 2Load the sample shop, import a CSV or JSON file, or write CREATE TABLE statements.
  3. 3Write a query and press Ctrl+Enter (or select part of the script to run just that).
  4. 4Sort the results, export them, or click Explain to see the query plan.

Frequently asked questions

Is this a real PostgreSQL?

Yes. PGlite is PostgreSQL 18 compiled to WebAssembly, running as a single-user database in your browser. Extensions that need a server process, replication and network access are not available.

Where is my data stored?

In memory, in this browser tab. Tick “Keep in this browser” to store it in IndexedDB on this device, or use Database → Save to download it. Nothing is uploaded.

Can I open an existing SQLite database?

Yes. Database → Open accepts .sqlite and .db files and switches to SQLite automatically. Database → Save gives you the file back after your changes.

How do I stop a query that never finishes?

Press Stop. The engine runs in a background worker, so it can be stopped without freezing the page; an in-memory database restarts empty, a kept one restarts from what was saved.

Why does the first start take a few seconds?

The database engine is downloaded and compiled the first time — about 6 MB for PostgreSQL and 1 MB for SQLite. Later visits use the browser cache.

Can I import my own data?

Use Import CSV / JSON. Column types are inferred (integers, decimals, booleans, dates, JSON), a table named after the file is created, and the rows are inserted.

Related tools