Results for “Ownership & optional values”
Small, practical examples. Search by task or narrow things down below.
Remove duplicate values
Use a JavaScript Set to preserve the first occurrence of each primitive value.
JavaScript✓ Tested
Remove duplicate values while keeping the smallest key
SQL: Identify retained keys in a grouped subquery before deleting other copies.
SQL✓ Tested
Remove duplicate values while keeping the smallest key
SQL Server: Identify retained keys in a grouped subquery before deleting other copies.
SQL Server✓ Tested
Remove duplicate values while keeping the smallest key
Postgres: Identify retained keys in a grouped subquery before deleting other copies.
Postgres✓ Tested
Remove duplicate values while keeping the smallest key
SQLite: Identify retained keys in a grouped subquery before deleting other copies.
SQLite✓ Tested
Remove duplicate values with a Set
Keep the first occurrence order while deduplicating.
Set✓ Tested
Remove odd values
Use the erase-remove idiom to filter a C++ vector in place.
C++✓ Tested
Render an optional notice
Render an optional notice with a small React component and explicit browser behavior.
React✓ Tested
Render nothing from an optional component
Render nothing from an optional component with a small React component and explicit browser behavior.
React✓ Tested
Report duplicate business values and their frequency
SQL: Group by a candidate business key and retain only groups with multiple rows.
SQL✓ Tested
Report duplicate business values and their frequency
SQL Server: Group by a candidate business key and retain only groups with multiple rows.
SQL Server✓ Tested
Report duplicate business values and their frequency
Postgres: Group by a candidate business key and retain only groups with multiple rows.
Postgres✓ Tested