FIND YOUR NEXT FEW LINES

Results for “SQL”

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

500 snippets foundClear filters
PostgresSchema design & transactions

Expose a reusable filtered view

Postgres: A view stores a query definition rather than a snapshot of its rows.

Postgres✓ Tested
SQLiteJSON data

Extract a JSON field

Read a scalar value from JSON text.

json_extract✓ Tested
PostgresDates & series

Extract part of a date

Read a calendar component with EXTRACT.

EXTRACT✓ Tested
SQLiteQueries & text

Extract part of a string

Use one-based positions with substr.

substr✓ Tested
SQLExpressions & aggregates

Filter aggregate groups

Keep only categories with multiple products.

HAVING✓ 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
PostgresReporting & grouped calculations

Filter rows before grouping

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

Postgres✓ Tested
SQLSelect & filter

Filter rows with WHERE

Keep products below a chosen price.

WHERE✓ Tested
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