SQL Playground

Run SQL (SQLite) fully in the browser with sample tables.

The SQL Playground is a small SQLite database that lives in your browser tab. It starts with three sample tables (customers, products, orders), so you can practise joins, grouping and updates without installing anything. Run one or many statements and see each result as a table.

What is SQLite and sql.js?

SQLite is a self-contained SQL database engine that stores a whole database in a single file and needs no server. It supports most of standard SQL: SELECT with joins, GROUP BY, subqueries, window functions and recursive WITH queries, plus INSERT, UPDATE, DELETE and CREATE TABLE. It is dynamically typed, so a column's declared type is a hint rather than a strict rule. sql.js is SQLite compiled to WebAssembly, which lets the same engine run inside a web page. This tool uses it with an in-memory database: nothing is saved, and reloading the page or pressing Reset database brings back the original sample data. Because the engine runs on the page's main thread, a very expensive query can make the page unresponsive until it finishes. That makes the tool good for learning, testing a query shape and prototyping, not for large data work.

How to use SQL Playground

  1. Wait for the engine A Loading SQLite engine spinner shows while the WebAssembly module loads. Run and Reset database are disabled until it is ready.
  2. Write SQL Edit the SQL box. It starts with a query that totals spending per customer. Look at the Schema panel for table and column names.
  3. Run it Click Run. Each statement appears under its own text with a result table or a Statement OK message with the rows affected, plus the elapsed time in milliseconds.
  4. Change data and check it Run an UPDATE, INSERT or CREATE TABLE followed by a SELECT in the same box to confirm the effect.
  5. Start over Click Reset database to drop your changes and reload the sample data.

Frequently asked questions

Is my data saved between visits?

No. The database exists only in memory for the open page. Reloading or closing the tab discards your tables, and Reset database restores the sample data.

Is my SQL sent anywhere?

No. The SQL engine runs in your page, and the statements and data stay there; nothing is sent to a server.

Why did my page freeze?

The engine runs on the browser's main thread. A heavy query, such as a large cross join or an endless recursive WITH, blocks the page until it ends. The 8 second time budget is only checked between statements, so it cannot interrupt one long statement. Reload the page to recover.

How many rows can I see?

Each result shows at most 1,000 rows. The footer states how many were found, counting up to 100,000, after which it shows a lower bound such as 100,000+.

Which SQL dialect is this?

SQLite, through sql.js. Features and quirks follow SQLite, for example flexible column typing, strftime for dates and no separate boolean type.

Can I load my own data?

There is no file import. You can create tables and INSERT rows by typing SQL. To run a SELECT over a CSV file, use the CSV Query as SQL tool.