Skip to content
ohsudo

SQL Playground

Run real SQL in your browser on PostgreSQL 18 or SQLite 3, with sample databases. SELECT, JOIN, CREATE, ALTER, GRANT — the real engine, nothing simulated.

● Runs 100% in your browser — nothing you type leaves this page.

Engine

● Real PostgreSQL 18.6 (PGlite 0.5.10) running in your browser. Nothing is simulated, nothing is sent anywhere. MySQL, MariaDB, SQL Server and Oracle can’t run in a browser. For their syntax, see the SQL Dialect Reference.

Ctrl+Enter runs the editor. Separate statements with ;

Starting PostgreSQL 18.6 in your browser (downloaded once, a few MB)…

Results

Run a query to see the results here.

Examples

Click to load an example into the editor and run it.

The address bar updates as you go, so you can bookmark or share the result.

What exactly runs here?

Two real database engines, compiled to WebAssembly and running inside your browser tab:

Engine Version How
PostgreSQL 18.6 PGlite — the actual PostgreSQL source code, built for the browser
SQLite 3.54.0 sql.js — the official SQLite library, built for the browser

Nothing is simulated: every query, result and error comes from the real engine. Nothing leaves your browser either — there is no server behind this page. Reset database puts the sample data back.

Note

MySQL, MariaDB, SQL Server and Oracle are not available here, and we won’t fake them. MySQL and MariaDB have no stable browser build yet; SQL Server and Oracle are commercial products that can’t run in a browser. To see how the same query is written for them, use the SQL Dialect Reference.

How to use it

  1. Pick the engine and a sample database: Company (employees, departments, projects), Shop (customers, products, orders) or an empty one.
  2. Write SQL in the editor — table and column names autocomplete — and press Run or Ctrl+Enter. You can run several statements at once, separated by ;.
  3. Each statement gets its own result: rows for SELECT, “rows affected” for INSERT/UPDATE/DELETE, OK for everything else.
  4. Click a table on the left to preview it, or an example to load and run it.

The link in your address bar contains your query, so you can share it.

Practice permissions (PostgreSQL)

Users and GRANT behave exactly like on a PostgreSQL server. Try this on the Company database:

CREATE ROLE analyst LOGIN;
GRANT SELECT ON employees TO analyst;
SET ROLE analyst;
SELECT count(*) FROM employees; -- works
DELETE FROM employees WHERE id = 20; -- ERROR: permission denied for table employees

Then run RESET ROLE; to become the superuser again. The sidebar always shows who you are connected as. SQLite has no users or permissions, so this only works on PostgreSQL.

FAQ

Is my data saved?

No. The database lives in your browser tab’s memory and starts fresh when you reload the page — perfect for experimenting, DROP TABLE included.

Why does an error still change my data?

When you run several statements, the ones before the failing statement have already been executed — just like in psql or the sqlite3 shell. Wrap them in BEGIN; … COMMIT; to make them all-or-nothing.

How big is the download?

PostgreSQL is a few megabytes and SQLite about one; both download only when you open this page, and your browser caches them afterwards.

Articles

Learn more