Results for “when”
Small, practical examples. Search by task or narrow things down below.
Keep both matching and rejected values
TypeScript: Use two explicit outputs when a caller needs both sides of a classification.
TypeScript✓ Tested
Keep parent rows while filtering joined children
SQL: Put a child filter in ON when unmatched parents must remain in the result.
SQL✓ Tested
Keep parent rows while filtering joined children
SQL Server: Put a child filter in ON when unmatched parents must remain in the result.
SQL Server✓ Tested
Keep parent rows while filtering joined children
Postgres: Put a child filter in ON when unmatched parents must remain in the result.
Postgres✓ Tested
Keep parent rows while filtering joined children
SQLite: Put a child filter in ON when unmatched parents must remain in the result.
SQLite✓ Tested
Keep unmatched rows with LEFT JOIN
Show every product even when stock is missing.
LEFT JOIN✓ Tested
Label rows with CASE
Derive a readable label from a condition.
CASE✓ Tested
List distinct values
Remove duplicate category values from a result.
DISTINCT✓ Tested
List files containing a match
Linux Commands: Use grep -l when only the matching filenames are needed.
Linux Commands✓ Tested
Match one of several values
Use IN to avoid repeating equality conditions.
IN✓ Tested
Merge a branch only by fast-forward
Refuse to create an unexpected merge commit.
merge✓ Tested
Merge two dictionaries
Combine two dictionaries into a new dictionary. When a key appears in both inputs, the value from the second dictionary wins.
dictionary✓ Tested