One WHERE clause cannot say ‘has a PC but no laptop’. Here are three queries that can, and the NULL trap.
CASE Expression Pitfalls: NULL Tests and Data Type Precedence
Reproduce CASE expression traps with NULL tests, mixed result types, missing ELSE, and nesting, then apply clear rewrites.
CASE Sort Priority: Put Business Order Before Alphabetical Order
CASE sort priority makes the queue policy explicit. Map known statuses to numeric ranks and keep missing or unfamiliar labels visible. Finish tied ranks with a unique key.
CHOOSE: Handle Indexes Outside the List
CHOOSE returns an item from a positional list. Check unsupported indexes and compare a consistently typed CASE expression with an explicit fallback.




