FIND YOUR NEXT FEW LINES

Results for “Schema design & transactions”

Small, practical examples. Search by task or narrow things down below.

377 snippets foundClear filters
PostgresRows & writes

Get the latest row in each group

Select one ordered row per key with DISTINCT ON.

DISTINCT ON✓ Tested
PostgresGetting Started

Give a result column a readable name

Postgres: Use AS to label a computed result column.

Postgres✓ Tested
SQLReporting & grouped calculations

Group by more than one field

SQL: Each distinct combination of grouping fields produces its own row.

SQL✓ Tested
SQL ServerReporting & grouped calculations

Group by more than one field

SQL Server: Each distinct combination of grouping fields produces its own row.

SQL Server✓ Tested
PostgresReporting & grouped calculations

Group by more than one field

Postgres: Each distinct combination of grouping fields produces its own row.

Postgres✓ Tested
SQLiteReporting & grouped calculations

Group by more than one field

SQLite: Each distinct combination of grouping fields produces its own row.

SQLite✓ Tested
SQLSubqueries & ranked selection

Include every row tied for the highest score

SQL: Compare with MAX rather than limiting to an arbitrary number of rows.

SQL✓ Tested
SQL ServerSubqueries & ranked selection

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
PostgresSubqueries & ranked selection

Include every row tied for the highest score

Postgres: Compare with MAX rather than limiting to an arbitrary number of rows.

Postgres✓ Tested
SQLiteSubqueries & ranked selection

Include every row tied for the highest score

SQLite: Compare with MAX rather than limiting to an arbitrary number of rows.

SQLite✓ Tested
SQLSubqueries & ranked selection

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
SQL ServerSubqueries & ranked selection

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