Results for “or”
Small, practical examples. Search by task or narrow things down below.
Filter rows before grouping
SQLite: WHERE limits the rows contributing to the aggregate; it differs from filtering completed groups with HAVING.
SQLite✓ Tested
Find a median element without fully sorting
C++: nth_element partitions around the element that would occupy the chosen sorted position.
C++✓ Tested
Find both extremes in one algorithm call
C++: Check for a nonempty input before dereferencing the returned iterators.
C++✓ Tested
Find common factors and multiples
Python: Use the integer gcd and lcm helpers to avoid floating-point calculations.
Python✓ Tested
Find lines common to two sorted files
Linux Commands: Use comm -12 to suppress the two columns of unmatched lines.
Linux Commands✓ Tested
Find lines unique to the first sorted file
Linux Commands: Use comm -23 to retain only records absent from the second input.
Linux Commands✓ Tested
Find records without any related rows
SQL: NOT EXISTS avoids the NULL pitfalls of NOT IN when the subquery column can be missing.
SQL✓ Tested
Find records without any related rows
SQL Server: NOT EXISTS avoids the NULL pitfalls of NOT IN when the subquery column can be missing.
SQL Server✓ Tested
Find records without any related rows
Postgres: NOT EXISTS avoids the NULL pitfalls of NOT IN when the subquery column can be missing.
Postgres✓ Tested
Find records without any related rows
SQLite: NOT EXISTS avoids the NULL pitfalls of NOT IN when the subquery column can be missing.
SQLite✓ Tested
Find rows with a related record
Use EXISTS without duplicating the outer rows.
EXISTS✓ Tested
Find sorted set members missing from another set
C++: set_difference writes elements present in the first sorted input but absent from the second.
C++✓ Tested