Results for “Sensor calculations”
Small, practical examples. Search by task or narrow things down below.
Count rows satisfying separate conditions
Postgres: SUM over CASE expressions calculates several conditional counts in one scan.
Postgres✓ Tested
Count rows satisfying separate conditions
SQLite: SUM over CASE expressions calculates several conditional counts in one scan.
SQLite✓ Tested
Detect integer addition overflow
Java: Math.addExact throws rather than silently wrapping on overflow.
Java✓ Tested
Display an integer as unsigned
Java: Use unsigned conversion methods when interpreting a fixed-width bit pattern.
Java✓ Tested
Distinguish row count from non-null value count
SQL: COUNT(*) includes every row while COUNT(column) skips NULL values.
SQL✓ Tested
Distinguish row count from non-null value count
SQL Server: COUNT(*) includes every row while COUNT(column) skips NULL values.
SQL Server✓ Tested
Distinguish row count from non-null value count
Postgres: COUNT(*) includes every row while COUNT(column) skips NULL values.
Postgres✓ Tested
Distinguish row count from non-null value count
SQLite: COUNT(*) includes every row while COUNT(column) skips NULL values.
SQLite✓ Tested
Divide decimal values with controlled precision
Java: Choose both scale and rounding for a quotient that does not terminate in base ten.
Java✓ Tested
Divide negative integers with floor rounding
Java: floorDiv and floorMod provide consistent floor-based quotient and remainder.
Java✓ Tested
Filter rows before grouping
SQL: WHERE limits the rows contributing to the aggregate; it differs from filtering completed groups with HAVING.
SQL✓ Tested
Filter rows before grouping
SQL Server: WHERE limits the rows contributing to the aggregate; it differs from filtering completed groups with HAVING.
SQL Server✓ Tested