SQL playground

Edit and run SQL in your browser against a seeded SQLite database.

Edit this pageReport an issue

Every query below runs entirely in your browser (SQLite compiled to WebAssembly) — nothing is sent anywhere. Edit the SQL and press Run (or ⌘/Ctrl + Enter).

This site is a T-SQL (SQL Server) reference, and SQLite is a deliberate choice for the sandbox, not a compromise: it covers the portable core T-SQL shares with every other engine — clauses, joins, aggregates, window functions — with zero setup and nothing sent to a server. Syntax that's genuinely SQL Server-only (TOP, CROSS/OUTER APPLY, MERGE, OUTPUT, TRY/CATCH, table variables) can't run here — those pages show it as static reference code instead, clearly marked, rather than pretending it's runnable in this sandbox.

SQL playground
Loading editor…
⌘/Ctrl + Enter

Aggregation and grain

GROUP BY collapses rows to one per group. Every non-aggregated column in the SELECT list has to be grouped or aggregated.

SQL playground
Loading editor…
⌘/Ctrl + Enter

NULL semantics

NULL is not equal to anything — filter with IS NULL, and remember that COUNT(column) skips nulls while COUNT(*) does not.

SQL playground
Loading editor…
⌘/Ctrl + Enter

Window functions and ties

RANK() leaves gaps after a tie; DENSE_RANK() does not; ROW_NUMBER() breaks ties arbitrarily unless you add a tiebreaker.

SQL playground
Loading editor…
⌘/Ctrl + Enter

Running totals

A window aggregate keeps row-level detail while accumulating.

SQL playground
Loading editor…
⌘/Ctrl + Enter

Available tables

tablecolumns
customerscustomer_id, name, country
ordersorder_id, customer_id, order_date, amount, status, cancelled_at
employeesemployee_id, name, department_id, salary
product_salesproduct_id, category_id, product_name, sales
monthly_revenuemonth, revenue

The dataset is small and reset on every page load — it's for checking semantics (nulls, ties, join fan-out, partitioning), not for performance testing.

Was this page helpful?