Every T-SQL pattern, runnable in your browser
A practical T-SQL (SQL Server) reference for the clauses, joins, window functions, and edge cases that break production queries. Most examples run live in your browser; the syntax that’s genuinely SQL-Server-only is called out clearly where it can’t. An AI assistant is grounded in every page.
This runs real SQLite — edit it
Loading editor…
Everything in one place
Reference, runnable examples, an AI assistant, and a diagnostic tool for the query that won’t cooperate.
Reference
Core clauses, functions, joins, and window functions — each with the edge cases that break production queries.
Tutorials
Guided paths through the reference, in order — fundamentals, window functions, writing data, and troubleshooting.
Recipes
Copy-paste solutions to the problems people actually hit: top-N per group, dedup, pivot, gaps and islands.
Playground
A full SQL editor running real SQLite in your browser, against a seeded database. No signup.
Query Doctor
Paste a broken query and its error. Get the root cause, a corrected query, and how to avoid it next time.
Writing & transactions
INSERT, UPDATE, DELETE — plus BEGIN/COMMIT/ROLLBACK and isolation levels for changes that must not half-apply.
Performance
What an index actually does, the patterns that silently defeat one, and how to read a query plan on any engine.
Dialect comparison
The same ~16 operations side by side across PostgreSQL, MySQL, SQL Server, and SQLite.
Cheat sheet
Every clause, join, and function on one page — syntax and a one-line reminder, nothing else.
Runnable, not just described
Every example executes against a real database, right on the page. Edit it, run it, break it.
AI that's grounded
The assistant answers from these exact docs and links the page it used — not a guess from training data.
Edge cases first
The gotcha that makes the query wrong in production is the point of the page, not a footnote at the bottom.
From the blog
All postsOctober 6, 2026
CTE vs temp table vs table variable: which one in T-SQL
Three ways to name an intermediate result in T-SQL, and they are not interchangeable — one gets real statistics, one doesn't, and one disappears the moment you close over it.
October 6, 2026
ISNULL vs COALESCE: the truncation bug T-SQL lets you write
Both fill in a value when something is NULL. They pick the output's data type by completely different rules, and the difference silently truncates real data in exactly the cases where it matters most.
October 6, 2026
Reading a SQL Server execution plan: the Key Lookup problem
The graphical plan in SSMS has its own vocabulary — operators, arrow thickness, cost percentages — and one specific icon pattern that's worth learning to spot on sight.
Start with the clause that’s biting you
Or open the playground and paste the query you’re stuck on.