SQL playground

Write SQL and run it straight away on a real SQLite database inside your browser. Practice on the sample shop data, open your own .sqlite file, or import a CSV and query it.

How to SQL playground

  1. Write a query in the SQL box, or choose one from Example queries. Click a table or column name on the left to insert it.
  2. Click Run or press Ctrl + Enter. Results appear below as a table.
  3. To use your own data, click Open SQLite File or Import CSV as Table.

What you can do here

  • Learn and practice SQL. The sample database is a small shop with customers, products, orders and order items, which is enough for joins, grouping, subqueries and window functions.
  • Query a CSV with SQL. Import a spreadsheet export and run GROUP BY and JOIN on it instead of fighting with formulas.
  • Inspect a SQLite file. Open the database from an app, a phone backup or a browser profile and look inside.
  • Test a query before running it somewhere that matters.
  • Build a database with CREATE TABLE and INSERT, then download it as a .sqlite file.

The sample database

TableColumns
customersid, name, email, city, country, joined
productsid, name, category, price, stock
ordersid, customer_id, ordered_at, status
order_itemsid, order_id, product_id, quantity, unit_price

SQL quick reference

SELECT column, ...            -- which columns
FROM table                    -- from which table
JOIN other ON other.id = table.other_id
WHERE condition               -- filter rows
GROUP BY column               -- one row per group
HAVING condition              -- filter groups
ORDER BY column DESC          -- sort
LIMIT 10;                     -- how many rows

About the engine

Queries run on SQLite, compiled to WebAssembly, on your own device. SQLite is the most widely used database engine in the world and follows standard SQL closely, so what you learn carries over to MySQL and PostgreSQL. A few things differ: SQLite is relaxed about column types, has no RIGHT JOIN in older versions, and uses functions such as strftime for dates.

Nothing you type or open is uploaded. The database lives in this tab's memory and is gone when you close or reload the page, so download it if you want to keep your changes. Tidy up a query with the SQL formatter, or create test rows with the mock data generator.

Frequently asked questions

Which SQL dialect does the playground use?

SQLite. It supports joins, subqueries, common table expressions, window functions, views, indexes and transactions.

Can I open my own database?

Yes. Click Open SQLite File and choose a .sqlite or .db file. It is read on your device and not uploaded.

Can I query a CSV file with SQL?

Yes. Click Import CSV as Table. The first row becomes the column names, and the file name becomes the table name.

Are my changes saved?

Only until you close or reload the page. Click Download Database to keep them as a .sqlite file.

Is there a size limit?

Databases up to a few hundred megabytes work on a computer. The limit is your device’s memory.