FIND YOUR NEXT FEW LINES

The snippet library.

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

25 snippets foundClear filters
SQLGetting Started

Join related rows from two tables

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

SQL✓ Tested
SQLGetting Started

Keep rows matching a condition

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

SQL✓ Tested
SQLGetting Started

Match a text prefix

SQL: Use a percent wildcard after a known prefix.

SQL✓ Tested
SQLGetting Started

Match one value from a short list

SQL: Use IN for a set of allowed values.

SQL✓ Tested
SQLGetting Started

Read named columns from a table

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

SQL✓ Tested
SQLGetting Started

Read the smallest and largest values

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

SQL✓ Tested
SQLGetting Started

Remove duplicate result values

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

SQL✓ Tested
SQLGetting Started

Require two filtering conditions

SQL: Combine category and quantity conditions with AND.

SQL✓ Tested
SQLGetting Started

Run a first SELECT query

SQL: Return a literal value without creating a table.

SQL✓ Tested
SQLGetting Started

Select values in an inclusive range

SQL: BETWEEN includes both endpoints of the range.

SQL✓ Tested
SQLGetting Started

Sort the highest quantities first

SQL: Specify descending order and a stable tie breaker.

SQL✓ Tested
SQLGetting Started

Turn a condition into a result label

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

SQL✓ Tested