Results for “Context & shared state”
Small, practical examples. Search by task or narrow things down below.
Calculate each group’s numeric spread
SQL Server: Subtract MIN from MAX to report the difference between extremes.
SQL Server✓ Tested
Calculate each group’s numeric spread
Postgres: Subtract MIN from MAX to report the difference between extremes.
Postgres✓ Tested
Calculate each group’s numeric spread
SQLite: Subtract MIN from MAX to report the difference between extremes.
SQLite✓ Tested
Catch a T-SQL error
Handle an expected conversion error in TRY/CATCH.
TRY CATCH✓ Tested
Check a script’s syntax without executing its body
Bash Scripts: bash -n parses commands but does not run ordinary script statements.
Bash Scripts✓ Tested
Clean up a temporary directory automatically
Python: Use TemporaryDirectory as a context manager so cleanup also happens after exceptions.
Python✓ Tested
Combine matching rows with INNER JOIN
Read product names with their matching stock values.
INNER JOIN✓ Tested
Combine results while retaining duplicates
SQL: UNION ALL does not spend work removing equal rows.
SQL✓ Tested
Combine results while retaining duplicates
SQL Server: UNION ALL does not spend work removing equal rows.
SQL Server✓ Tested
Combine results while retaining duplicates
Postgres: UNION ALL does not spend work removing equal rows.
Postgres✓ Tested
Combine results while retaining duplicates
SQLite: UNION ALL does not spend work removing equal rows.
SQLite✓ Tested
Combine results without duplicates
Merge compatible result sets with UNION.
UNION✓ Tested