Skip to content

SQL Playground

Run real SQLite in your browser: write a query against a sample shop or your own tables, and see every result set, the schema and the query plan.

Ctrl + Enter (⌘ + Enter) runs it. Each run starts from the setup script, so nothing you change is kept.
Setup script — tables and data

Results

Loading SQLite — about 650 KB, once. Every query then runs here, in your browser.

Runs in your browser — nothing you enter leaves this device.

About this tool

What it does

SQL Playground runs SQLite — the real database engine, compiled to WebAssembly — inside your browser. It opens with a small sample shop (customers, products and orders) so you can try joins, GROUP BY, window functions such as RANK and running totals, common table expressions and EXPLAIN QUERY PLAN straight away. Every statement that returns rows gets its own result table, and the side panel lists each table with its columns, keys and row count. Change the setup script to build your own tables, or paste one from a project. Each run starts from the setup script on a fresh database, so you can DELETE or DROP anything and simply run again.

How to use it
  1. Wait a moment on first visit while SQLite loads (about 650 KB, once); the sample query then runs by itself.
  2. Pick an example query, or write your own in the Query box.
  3. Press Run, or Ctrl + Enter (⌘ + Enter on a Mac).
  4. Read the results; download any result set as CSV.
  5. Open “Setup script” to see or change the tables and data every run starts from — or press “Start empty” and write your own CREATE TABLE statements.
  6. Use the Tables panel to check column names and types while you write.
Limits and your data
  • This is SQLite. Most standard SQL works, but other databases differ: types are flexible (a column declared INTEGER can hold text), and functions such as DATE_ADD from MySQL or ILIKE from PostgreSQL are not available.
  • Each result shows up to 1,000 rows; the full count is given and CSV downloads the rows shown.
  • A query that runs for more than 8 seconds is stopped, so an endless recursive query cannot freeze the page.
  • Nothing is saved between runs or visits. Keep your setup script somewhere safe if you need it again.
  • The engine is not part of the offline download, so the first visit needs a connection.
  • Your SQL and data never leave the browser: the database lives in memory inside this page and disappears with each run. Only the SQLite engine itself is downloaded, from this site.

Questions

Is this a real database or a simulation?

Real. It is SQLite 3, the same engine that ships in Android, iOS and every major browser, built for WebAssembly by the open-source sql.js project. Query plans, constraints and errors are SQLite’s own.

Why did my changes disappear?

Each run rebuilds the database from the setup script, then runs your query. That makes every result reproducible and lets you experiment freely. To keep a change, put it in the setup script.

Why is money stored in paise in the sample?

Floating-point numbers cannot hold most decimal amounts exactly — 0.1 + 0.2 is not 0.3 — so sums of prices drift. Storing whole paise as integers and dividing by 100 only for display keeps every total exact.

Can I load my own database file?

Not yet. Paste the CREATE TABLE and INSERT statements (for example from sqlite3’s .dump) into the setup script instead.