FIND YOUR NEXT FEW LINES

Results for “Postgres”

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

250 snippets foundClear filters
PostgresGetting Started

Find missing values with IS NULL

Postgres: Use IS NULL rather than equality to test for missing data.

Postgres✓ Tested
PostgresRelationships & missing data

Find parents whose every child meets a rule

Postgres: Combine existence with the absence of a violating child to exclude parents with no children.

Postgres✓ Tested
PostgresRelationships & missing data

Find parents with at least two child rows

Postgres: Use a correlated count when testing a per-parent threshold.

Postgres✓ Tested
PostgresRelationships & missing data

Find records without any related rows

Postgres: NOT EXISTS avoids the NULL pitfalls of NOT IN when the subquery column can be missing.

Postgres✓ Tested
PostgresBulk changes & set operations

Find rows in the first result but not the second

Postgres: EXCEPT calculates a distinct result-set difference.

Postgres✓ Tested
PostgresBulk changes & set operations

Find rows shared by two query results

Postgres: INTERSECT compares complete selected rows and removes duplicates.

Postgres✓ Tested
PostgresSubqueries & ranked selection

Find the second-highest distinct value

Postgres: Select the maximum below the overall maximum to skip ties at the top.

Postgres✓ Tested
PostgresRelationships & missing data

Generate every combination of two sets

Postgres: CROSS JOIN creates one result per possible pair, so the output size is the product of the input sizes.

Postgres✓ Tested
PostgresGetting Started

Give a result column a readable name

Postgres: Use AS to label a computed result column.

Postgres✓ Tested
PostgresReporting & grouped calculations

Group by more than one field

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

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

Include missing values in a not-equal filter

Postgres: Ordinary inequality does not include NULL; explicitly include it when that is the intended rule.

Postgres✓ Tested