Results for “ORDER BY”
Small, practical examples. Search by task or narrow things down below.
Join rows in a chosen order
Aggregate text with STRING_AGG and WITHIN GROUP.
STRING_AGG✓ Tested
Join text rows in a chosen order
Combine values using string_agg.
string_agg✓ Tested
Join two sorted files by a shared key
Linux Commands: Use join for sorted, simple delimiter-separated records with one row per key.
Linux Commands✓ Tested
Keep caller data unchanged by passing a structure by value
C: A value parameter is a copy of the original structure.
C✓ Tested
Keep loop state by avoiding a pipeline subshell
Bash Scripts: Redirect input into a while loop so updates to a counter remain in the current shell.
Bash Scripts✓ Tested
Limit the bytes read from a stream
Limit the bytes read from a stream using a complete Go program with explicit sample inputs.
Go✓ Tested
List files changed by the current commit
Git: diff-tree exposes the paths changed between a commit and its parent.
Git✓ Tested
List files tracked by Git
Git: ls-files reads the index instead of listing every file in the working directory.
Git✓ Tested
List regular files recursively in sorted order
C++: Collect relative paths before sorting because directory iteration order is unspecified.
C++✓ Tested
List unordered pairs without duplicate reversals
SQL: Join using an increasing key comparison to omit self-pairs and reversed duplicates.
SQL✓ Tested
List unordered pairs without duplicate reversals
SQL Server: Join using an increasing key comparison to omit self-pairs and reversed duplicates.
SQL Server✓ Tested
List unordered pairs without duplicate reversals
Postgres: Join using an increasing key comparison to omit self-pairs and reversed duplicates.
Postgres✓ Tested