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
SQL ServerWindow analytics

Divide an ordered result into numbered buckets

SQL Server: NTILE distributes rows across buckets; include a unique tie-breaker for deterministic assignment.

SQL Server✓ Tested
PostgresWindow analytics

Divide an ordered result into numbered buckets

Postgres: NTILE distributes rows across buckets; include a unique tie-breaker for deterministic assignment.

Postgres✓ Tested
SQLiteWindow analytics

Divide an ordered result into numbered buckets

SQLite: NTILE distributes rows across buckets; include a unique tie-breaker for deterministic assignment.

SQLite✓ Tested
SQLConstraints & defaults

Enforce a bounded numeric range

SQL: A named CHECK constraint keeps numeric values inside an inclusive interval.

SQL✓ Tested
SQL ServerConstraints & defaults

Enforce a bounded numeric range

SQL Server: A named CHECK constraint keeps numeric values inside an inclusive interval.

SQL Server✓ Tested
PostgresConstraints & defaults

Enforce a bounded numeric range

Postgres: A named CHECK constraint keeps numeric values inside an inclusive interval.

Postgres✓ Tested
SQLiteConstraints & defaults

Enforce a bounded numeric range

SQLite: A named CHECK constraint keeps numeric values inside an inclusive interval.

SQLite✓ Tested
PostgresJSON & arrays

Expand an array into rows

Use WITH ORDINALITY to retain original element order.

unnest✓ Tested
PostgresDates & series

Extract part of a date

Read a calendar component with EXTRACT.

EXTRACT✓ Tested
PostgresGetting Started

Filter by a numeric comparison

Postgres: Keep rows whose quantity exceeds a chosen threshold.

Postgres✓ Tested
PostgresGetting Started

Filter groups after aggregation

Postgres: Use HAVING to test a group’s calculated total.

Postgres✓ Tested
SQLReporting & grouped calculations

Filter rows before grouping

SQL: WHERE limits the rows contributing to the aggregate; it differs from filtering completed groups with HAVING.

SQL✓ Tested