Nullable NOT IN needs a clear rule for unknown identifiers. Compare NULL and empty-set results before changing the query or interpreting a Row Count Spool.
JSON_QUERY or JSON_VALUE: Match the JSON Shape
JSON_QUERY or JSON_VALUE depends on the JSON shape you need. One read-only document exposes scalar, object, array, JSON null and missing-path results side by side.
GREATEST and LEAST: Find Row Extremes With NULLs
GREATEST and LEAST compare several expressions within one row. These typed decimal examples show negative numbers, ties, partial NULLs and an entirely missing row.
NULLIF Denominators: Keep Zero and Missing Values Visible
NULLIF denominators turn zero into NULL for a deliberate division policy. This complete example keeps zero, missing inputs and integer truncation visible beside the decimal result.
Salary Ranges: Match Overlapping Intervals in SQL Server
Match salary ranges using both boundaries of the job and candidate intervals. Define open bounds and test containment, endpoint contact and invalid input.
Check Constraints That Enforce Business Rules
Check constraints keep row rules inside SQL Server, but NULL behavior and trusted status determine how much protection they provide.
TOP WITH TIES: Keep Every Row at the Cutoff
TOP WITH TIES helps me keep equally qualified rows at a shortlist boundary. A unique ordering key changes that selection. Separate the cutoff rule from the final display order.







