Results for “WHERE”
Small, practical examples. Search by task or narrow things down below.
Filter rows before grouping
Postgres: WHERE limits the rows contributing to the aggregate; it differs from filtering completed groups with HAVING.
Postgres✓ Tested
Filter rows before grouping
SQLite: WHERE limits the rows contributing to the aggregate; it differs from filtering completed groups with HAVING.
SQLite✓ Tested
Generate numbers with a recursive CTE
Build a bounded sequence using SQL recursion.
recursive CTE✓ Tested
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
Select the top row in each group with a tie-breaker
SQL: Filter an outer query on ROW_NUMBER because window functions are not evaluated in WHERE.
SQL✓ Tested
Select the top row in each group with a tie-breaker
SQL Server: Filter an outer query on ROW_NUMBER because window functions are not evaluated in WHERE.
SQL Server✓ Tested
Select the top row in each group with a tie-breaker
Postgres: Filter an outer query on ROW_NUMBER because window functions are not evaluated in WHERE.
Postgres✓ Tested
Select the top row in each group with a tie-breaker
SQLite: Filter an outer query on ROW_NUMBER because window functions are not evaluated in WHERE.
SQLite✓ Tested
Set a Compose service’s working directory
Docker / Compose: working_dir changes where the container command starts.
Docker / Compose✓ Tested
Test missing values with IS NULL
Find rows where an optional value is absent.
IS NULL✓ Tested
Update one row using its primary key
SQL: Use a precise WHERE condition to change only the intended row in a scratch table.
SQL✓ Tested
Update one row using its primary key
SQL Server: Use a precise WHERE condition to change only the intended row in a scratch table.
SQL Server✓ Tested