Results for “Collections & data structures”
Small, practical examples. Search by task or narrow things down below.
Iterate over a fixed array of records
C: Compute the array element count with sizeof at the point where it is still an array.
C✓ Tested
Iterate over bounded chunks
Iterate over bounded chunks using a complete Go program with explicit sample inputs.
Go✓ Tested
Join a parent to pre-aggregated totals
SQL: Aggregate the child rows first to produce at most one joined row per parent.
SQL✓ Tested
Join a parent to pre-aggregated totals
SQL Server: Aggregate the child rows first to produce at most one joined row per parent.
SQL Server✓ Tested
Join a parent to pre-aggregated totals
Postgres: Aggregate the child rows first to produce at most one joined row per parent.
Postgres✓ Tested
Join a parent to pre-aggregated totals
SQLite: Aggregate the child rows first to produce at most one joined row per parent.
SQLite✓ Tested
Join through a lookup table
SQL: Use explicit aliases and join keys when enriching records through two relationships.
SQL✓ Tested
Join through a lookup table
SQL Server: Use explicit aliases and join keys when enriching records through two relationships.
SQL Server✓ Tested
Join through a lookup table
Postgres: Use explicit aliases and join keys when enriching records through two relationships.
Postgres✓ Tested
Join through a lookup table
SQLite: Use explicit aliases and join keys when enriching records through two relationships.
SQLite✓ Tested
Keep function state between calls
C: A static local variable retains its stored value for the lifetime of the process.
C✓ 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