FIND YOUR NEXT FEW LINES

The snippet library.

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

25 snippets foundClear filters
PostgresGetting Started

Join related rows from two tables

Postgres: Match a category key to its display label with an explicit join condition.

Postgres✓ Tested
PostgresGetting Started

Keep rows matching a condition

Postgres: Use WHERE to select rows with a particular category.

Postgres✓ Tested
PostgresGetting Started

Match a text prefix

Postgres: Use a percent wildcard after a known prefix.

Postgres✓ Tested
PostgresGetting Started

Match one value from a short list

Postgres: Use IN for a set of allowed values.

Postgres✓ Tested
PostgresGetting Started

Read named columns from a table

Postgres: Choose the columns needed and request a deterministic row order.

Postgres✓ Tested
PostgresGetting Started

Read the smallest and largest values

Postgres: Use MIN and MAX without sorting and fetching every row.

Postgres✓ Tested
PostgresGetting Started

Remove duplicate result values

Postgres: Use DISTINCT when repeated category values are not useful.

Postgres✓ Tested
PostgresGetting Started

Require two filtering conditions

Postgres: Combine category and quantity conditions with AND.

Postgres✓ Tested
PostgresGetting Started

Run a first SELECT query

Postgres: Return a literal value without creating a table.

Postgres✓ Tested
PostgresGetting Started

Select values in an inclusive range

Postgres: BETWEEN includes both endpoints of the range.

Postgres✓ Tested
PostgresGetting Started

Sort the highest quantities first

Postgres: Specify descending order and a stable tie breaker.

Postgres✓ Tested
PostgresGetting Started

Turn a condition into a result label

Postgres: Use CASE to describe stock availability for each row.

Postgres✓ Tested