Skip to content

SQL online editor

A SQL playground with a ready-made shop database. Write a query, press Run, see the table. Runs on SQLite inside your browser.

query.sql · SQLite
SELECT * FROM customers;

The sample database

TableColumns
customersid, name, city, joined
productsid, name, category, price
ordersid, customer_id → customers.id, ordered_at, total
order_itemsorder_id → orders.id, product_id → products.id, qty

Three customers (Margaret, Hedy, Barbara) have never ordered, and order 108 belongs to customer 9, who isn’t in the table. That’s deliberate: an INNER JOIN, a LEFT JOIN and a FULL OUTER JOIN each return a different number of rows, so you can see the difference instead of memorising it. The SQL joins explainer walks through it visually.

Practise SQL online

Pick a query from Examples to start: filtering, grouping with HAVING, a three-table join, a window function and a CTE with a running total. Press Schema to see every CREATE TABLE, and Download CSV to export a result.

Keep the SQL cheat sheet open alongside; each SELECT example there opens directly in this editor.

Frequently asked questions

Which SQL dialect does this editor use?

SQLite 3, compiled to WebAssembly (sql.js). Standard SELECT, JOIN, GROUP BY, subqueries, CTEs, window functions and FULL OUTER JOIN all work. MySQL- or PostgreSQL-specific functions may need small changes.

Is my data uploaded anywhere?

No. The database lives in your browser’s memory. Reloading the page or pressing Reset DB restores the sample data.

Can I create my own tables?

Yes. CREATE TABLE, INSERT, UPDATE and DELETE work. Changes last until you reload or reset.

What is in the sample database?

A small shop: 8 customers, 8 products, 8 orders and their order_items. Some customers have no orders and one order points at a customer id that does not exist, so every kind of JOIN shows a visible difference.

Can AI write the query for me?

Describe what you want in the AI code generator with SQL selected, or press Explain / Fix under the editor to have the AI explain or repair the current query.