SQL playground. A real database in your browser.
Heads up: the first time you run a query, your browser downloads a one-time SQLite engine (~1 MB). After that it runs fully on your device, even offline, your data and queries are never sent to a server.
A real database that never leaves your laptop
This is a full SQLite engine (sql.js, compiled to WebAssembly) running inside the page, the same SQL you'd write against a production database. Prototype a query, learn JOINs and aggregates, or load a CSV export and slice it with SQL. Everything stays in memory on your device: no account, no upload, no row limits, and it keeps working offline once the engine is cached.
How to use the SQL Playground
This playground runs a real SQLite database inside your browser using sql.js, SQLite compiled to WebAssembly. It starts with a sample database of customers, orders and employees, and you can import your own CSV file as a new table. Use it to learn SQL, test a query before running it on a real database, or slice a spreadsheet export with SQL.
Step by step
-
Run your first query
The editor starts with SELECT * FROM customers;. Press Run query, or Ctrl + Enter (Cmd + Enter on a Mac). The first run downloads the SQLite engine once, which shows a progress bar, then loads the sample data and runs the query.
-
Try the examples
Under Examples, press a chip such as All customers, Top 5 orders by amount or JOIN: customer + total spent. Each one loads a ready query into the editor and runs it straight away, so you can read it and change it.
-
Write your own SQL
Type in the SQL query box. You can run several statements at once by ending each with a semicolon, and every statement that returns rows gets its own result table. The Tab key inserts two spaces instead of leaving the box.
-
Browse the tables
After the first run, the Tables list shows each table with its row count. Open a table to see its columns, their types and the PK mark on the primary key. Hover over a table name to show query, which runs SELECT * on it, and drop, which deletes it.
-
Import your own CSV
Press + CSV and pick a .csv, .tsv or .txt file up to 25 MB. In the dialog, check the Table name, leave First row is the column header ticked if the file has headers, look over the preview of the first rows, then press Create table.
-
Save results or start over
Above each result table, press Copy CSV to put that result on your clipboard, or Download CSV to save it as query-result.csv. Press Reset DB to throw away your changes and imported tables and restore the original sample data.
Reading the result
- Each result shows its size first, such as 8 rows · 5 columns for All customers. Number columns are aligned right, and a NULL value shows as NULL in gray italics.
- The JOIN: customer + total spent example returns all 8 customers. Ada Lovelace comes first with 2 orders and 448 spent, while Linus Torvalds and Guido van Rossum show 0 orders and NULL because they have no orders.
- Statements that change data or tables instead of returning rows, such as INSERT, UPDATE or CREATE TABLE, show a short confirmation such as 3 rows affected or Statement executed successfully.
- Errors appear in red after SQL error:, with SQLite's own message, such as a missing table or a typo near a keyword.
- Only the first 2,000 rows are drawn on screen. When a result has more, a note says so, and Copy CSV and Download CSV still include every row.
Tips and common mistakes
- This is SQLite, so some syntax from PostgreSQL, MySQL or SQL Server will not run. Dates are stored as text, which is why the sample uses values like 2023-04-01 that sort correctly.
- Importing a CSV with the same Table name as an existing table drops the old table and replaces it without asking. drop in the Tables list also deletes at once. Reset DB brings back the sample tables, but not a CSV table you imported.
- On import, each column becomes INTEGER, REAL or TEXT from its values. A column with any value that has a leading zero or a thousands separator becomes TEXT, so ZIP codes keep their zeros.
- Column names are cleaned on import: spaces and symbols become underscores and a name starting with a digit gets a leading underscore. Check the Tables list for the exact names before you query.
- Everything lives in memory. Reloading or closing the tab resets the database, so download any results you want to keep.
Privacy and limits
Your queries, the database and any imported file stay in your browser's memory and are never uploaded. The only network request comes the first time the engine is needed (your first run, Reset DB or import), when the sql.js files, about 1 MB, download from the cdn.jsdelivr.net CDN. No query or data goes with them. If you are offline before that first download, the engine cannot load. Imported files are limited to 25 MB.
Everything a query tool should do.
Frequently asked questions.
Is the SQL Playground free?
Is it private? Is my data uploaded anywhere?
Does it work offline?
Which SQL dialect does it support?
Will my imported tables persist after I close the tab?
How big a CSV can I import?
Published · Last updated .