Results for “Schema design & transactions”
Small, practical examples. Search by task or narrow things down below.
Get the latest row in each group
Select one ordered row per key with DISTINCT ON.
DISTINCT ON✓ Tested
Give a result column a readable name
Postgres: Use AS to label a computed result column.
Postgres✓ Tested
Group by more than one field
SQL: Each distinct combination of grouping fields produces its own row.
SQL✓ Tested
Group by more than one field
SQL Server: Each distinct combination of grouping fields produces its own row.
SQL Server✓ Tested
Group by more than one field
Postgres: Each distinct combination of grouping fields produces its own row.
Postgres✓ Tested
Group by more than one field
SQLite: Each distinct combination of grouping fields produces its own row.
SQLite✓ Tested
Include every row tied for the highest score
SQL: Compare with MAX rather than limiting to an arbitrary number of rows.
SQL✓ Tested
Include every row tied for the highest score
SQL Server: Compare with MAX rather than limiting to an arbitrary number of rows.
SQL Server✓ Tested
Include every row tied for the highest score
Postgres: Compare with MAX rather than limiting to an arbitrary number of rows.
Postgres✓ Tested
Include every row tied for the highest score
SQLite: Compare with MAX rather than limiting to an arbitrary number of rows.
SQLite✓ Tested
Include missing values in a not-equal filter
SQL: Ordinary inequality does not include NULL; explicitly include it when that is the intended rule.
SQL✓ Tested
Include missing values in a not-equal filter
SQL Server: Ordinary inequality does not include NULL; explicitly include it when that is the intended rule.
SQL Server✓ Tested