Understand three-valued logic in WHERE and CHECK, avoid NULL-poisoned NOT IN, and use SQL Server 2022 null-safe comparisons.
Convert Subquery to CTE: SQL in Sixty Seconds #001
You can convert subquery to CTE syntax by naming the inner query and using that name in the outer query. The first SQL in Sixty Seconds episode shows the change. My tests on SQL Server 2025 show the result stays the same, and that a CTE used twice reads the table twice.
ANY and ALL: Comparing a Value to a Whole Subquery in T-SQL
One missing price is enough to make ALL return nothing while ANY returns rows. Here is how to see it, and how to ask the question more safely.
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.
Large IN Lists: When a Temp Table Beats Thousands of Values
Pasting thousands of IDs into an IN list works, until it does not. See where the time goes and how to keep the answer the same with a temp table.
Relational Division in T-SQL: Customers Who Bought Every Product
Solve relational division with counts and double NOT EXISTS, then handle duplicates, NULL values, empty requirements, and exact matching.







