FIND YOUR NEXT FEW LINES

Results for “SQL”

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

500 snippets foundClear filters
PostgresRelationships & missing data

List unordered pairs without duplicate reversals

Postgres: Join using an increasing key comparison to omit self-pairs and reversed duplicates.

Postgres✓ Tested
PostgresConstraints & defaults

Make a pair of columns unique together

Postgres: A composite primary key permits repeated individual values while forbidding a duplicate combination.

Postgres✓ Tested
PostgresText cleanup & matching

Match a known text prefix

Postgres: A percent wildcard matches zero or more characters following the prefix.

Postgres✓ Tested
PostgresGetting Started

Match a text prefix

Postgres: Use a percent wildcard after a known prefix.

Postgres✓ Tested
SQLSelect & filter

Match one of several values

Use IN to avoid repeating equality conditions.

IN✓ Tested
PostgresGetting Started

Match one value from a short list

Postgres: Use IN for a set of allowed values.

Postgres✓ Tested
PostgresText cleanup & matching

Measure the length of ordinary text

Postgres: Use the engine’s text-length function; this ASCII example has no trailing spaces.

Postgres✓ Tested
SQLJoins & subqueries

Name an intermediate query with a CTE

Make a filtered result reusable within one statement.

CTE✓ Tested
PostgresText cleanup & matching

Normalize ASCII text to lowercase

Postgres: LOWER is useful for display normalization; indexed case-insensitive search depends on the database collation and schema.

Postgres✓ Tested
PostgresText cleanup & matching

Normalize ASCII text to uppercase

Postgres: UPPER changes character case under the database’s text rules.

Postgres✓ Tested
SQLiteQueries & text

Number a sorted result

Assign a row number without changing stored data.

row_number✓ Tested
PostgresWindows & text

Number rows within each group

Assign ordered row numbers with a window function.

row_number✓ Tested