Results for “SQL”
Small, practical examples. Search by task or narrow things down below.
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
Select values in an inclusive range
SQL: BETWEEN includes both endpoints of the range.
SQL✓ Tested
Select values in an inclusive range
SQL Server: BETWEEN includes both endpoints of the range.
SQL Server✓ Tested
Select values in an inclusive range
SQLite: BETWEEN includes both endpoints of the range.
SQLite✓ Tested
Show a group total beside each detail row
SQL: A partitioned aggregate preserves detail rows instead of collapsing them with GROUP BY.
SQL✓ Tested
Show a group total beside each detail row
SQL Server: A partitioned aggregate preserves detail rows instead of collapsing them with GROUP BY.
SQL Server✓ Tested
Show a group total beside each detail row
SQLite: A partitioned aggregate preserves detail rows instead of collapsing them with GROUP BY.
SQLite✓ Tested
Sort preferred rows ahead of other rows
SQL: A CASE ordering key expresses business priority before a stable secondary sort.
SQL✓ Tested
Sort preferred rows ahead of other rows
SQL Server: A CASE ordering key expresses business priority before a stable secondary sort.
SQL Server✓ Tested
Sort preferred rows ahead of other rows
SQLite: A CASE ordering key expresses business priority before a stable secondary sort.
SQLite✓ Tested
Sort the highest quantities first
SQL: Specify descending order and a stable tie breaker.
SQL✓ Tested
Sort the highest quantities first
SQL Server: Specify descending order and a stable tie breaker.
SQL Server✓ Tested