This Indexed View Restrictions Quiz asks which rule stops a unique clustered index on a view. The answer is the LEFT OUTER JOIN. A tested script shows the error, the working view, and what happens when each required rule is missing.
SQL SERVER – Solution to Puzzle – Simulate LEAD() and LAG() without Using SQL Server 2012 Analytic Function
Readers found five ways to simulate LEAD() and LAG() without the SQL Server 2012 analytic functions. This post shows each solution with its author, runs all five on SQL Server 2025 and compares the rows with the real functions. Four return the same ten rows and one adds a rule of its own.
SQL SERVER – Quick Note about JOIN – Common Questions and Simple Answers
A quick note about JOIN for T-SQL Tuesday: common questions I get in my office hours, answered simply, like which join method is better.
FOR XML AUTO in SQL Server: Nest Joined Rows and Name the Root
FOR XML AUTO turns a join into nested XML, with one element per table. This post shows where the element names come from, why row order decides the grouping, how ROOT adds a single root, and how the order of your columns flips the nesting. Every result comes from SQL Server 2025.
Many-to-Many Bridge Table in SQL Server: Model and Query It
A many-to-many bridge table links two tables that each have many partners in the other, such as orders and plants. This post builds one with a composite key and two foreign keys, then joins it three ways. It also shows what the keys block and why an inner join hides plants nobody ordered.
Unmatched Records Query: Four Ways to Find Rows With No Match
An unmatched records query finds the rows in one table that have no partner in another, such as plants that never sold. This post runs four versions on a small table: LEFT JOIN with a NULL test, NOT EXISTS, NOT IN and EXCEPT. It also shows the NULL trap that makes NOT IN return nothing.
Build a Query in Two Phases: Organize First, Itemize Second
Build a query in two phases: organize first, itemize second. Phase one gets the tables, joins and filter working with SELECT *, and phase two swaps the star for a column list. This post shows the method on a small branch and staff table, and the three errors it helps you avoid.







