SQL playground
Edit and run SQL in your browser against a seeded SQLite database.
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.
Loading editor…
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.
Loading editor…
NULL semantics
NULL is not equal to anything — filter with IS NULL, and remember that
COUNT(column) skips nulls while COUNT(*) does not.
Loading editor…
Window functions and ties
RANK() leaves gaps after a tie; DENSE_RANK() does not; ROW_NUMBER() breaks
ties arbitrarily unless you add a tiebreaker.
Loading editor…
Running totals
A window aggregate keeps row-level detail while accumulating.
Loading editor…
Available tables
| table | columns |
|---|---|
customers | customer_id, name, country |
orders | order_id, customer_id, order_date, amount, status, cancelled_at |
employees | employee_id, name, department_id, salary |
product_sales | product_id, category_id, product_name, sales |
monthly_revenue | month, 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.