TOPIC 04/3015 MINNOT STARTED

Patterns, lists, ranges and aliases: LIKE, IN, BETWEEN and AS

Filter by a pattern, a list or a range, give columns and tables short names, and learn the order a query really runs in, which explains most first errors.

L1–L4 are part of the Pro pass

L0 Explain simply

Analogy: a shelf label. You can ask for every jar whose name starts with B, for a list of colours you will accept, or for dates between two marks. You can also stick a short nickname on a long name. The nickname is for you. The shelf was filled before you stuck it on.

Daily List is a made-up to-do app (SYNTHETIC / TRAINING ONLY). Sam, the , filters task titles for Nina, the . A nickname in the wrong clause works on one database and fails on another.

What it is: (Structured Query Language) is a language for asking a database questions. A table is a grid, a row is one task, and a column is one fact. A matches text, where % means any run of characters and _ means one character. An alias is a nickname for a column or a table in one query. The logical processing order of a query is the sequence of steps, and the nickname is applied in the select list, which is after WHERE. You type all three in the query. The neighbour of an alias in WHERE is the real column name, which is safe to repeat.

Why it matters: SQLite accepts the nickname in WHERE. PostgreSQL's manual says the output name is not allowed there. A report can work on the practice file and fail when it moves.

A paper nickname sits on the label you already found. It does not help you find the jar.

PLAIN WORDS · 1 in this section
sqlite
a small free database tool

PICTURE IT

The picture is the one the lesson above opens with. The table below shows how each part of it matches the work.

THE REAL JOB A sorting office that removes junk before it writes labels.

  1. Table
  2. Filter
  3. Label
Sorting office

HOW THE PICTURE MAPS

How each part of the picture matches the work
In the pictureIn the work
Taking the right sackFROM
Removing junk mailWHERE
Writing the labelsSELECT
Putting letters in orderORDER BY

WHERE THIS PICTURE STOPS

  • A sorting office is a place, but a query is a plan.
  • Letters move once, but a query may be put in a new order for speed.
  • Sorters use judgement, but a database follows rules.

HOOK

Labels come last.

TELL A FRIEND

A sorting office: labels come last.

OFTEN MIXED UP WITH SQL (Structured Query Language) for BAs: filters, sorting and totals. That topic covers filters, sorting and totals. This one adds patterns, lists, ranges, aliases and the run order.

PRACTISE AND KEEP

Sources for this topic — 4 sources
  1. Market practice

    Pattern matching (PostgreSQL documentation) ↗ — PostgreSQL · PostgreSQL 18, §9.7 LIKE/ILIKE, escaping and collation scope; publisher page opened6November 2026. Dialect scope explicit.

    §9.7 LIKE/ILIKE, escaping and collation scope. PostgreSQL18 implementation, not a universal SQL mandate. · Checked 2026-11-06

    PostgreSQL18 publisher documentation opened on6November2026: §9.7 LIKE/ILIKE, escaping and collation scope. No execution on PostgreSQL is claimed; engine-specific examples remain scoped to18.

  2. Market practice

    SELECT command reference (PostgreSQL documentation) ↗ — PostgreSQL · PostgreSQL 18, SELECT: WHERE/HAVING/output aliases, functional dependence, NULL ordering and LIMIT; publisher page opened6November 2026. Dialect scope explicit.

    SELECT: WHERE/HAVING/output aliases, functional dependence, NULL ordering and LIMIT. PostgreSQL18 implementation, not a universal SQL mandate. · Checked 2026-11-06

    PostgreSQL18 publisher documentation opened on6November2026: SELECT: WHERE/HAVING/output aliases, functional dependence, NULL ordering and LIMIT. No execution on PostgreSQL is claimed; engine-specific examples remain scoped to18.

  3. Market practice

    SQLite: SQL expressions ↗ — SQLite project · SQLite: SQL expressions; CASE/BETWEEN/IN/EXISTS, scalar cardinality, NULL-safe equality and parameter values. Publisher page opened6November 2026.

    CASE/BETWEEN/IN/EXISTS, scalar cardinality, NULL-safe equality and parameter values. · Checked 2026-11-06

    Publisher documentation opened on6November2026. Engine/version scope is explicit; other database implementations may differ. Teaching queries are synthetic, not a required publisher template.

  4. Simplified educational illustration

    Payments Signal editorial teaching models — Payments Signal

    This site's own simplified teaching models. · Checked 2026-07-12

    What this simplifies: Daily List people, data and exercises are invented for teaching. Query results belong to the declared fixture and database version. Authorization, business identity, time bounds and unknown-value policy must be agreed in context; no universal mandatory query template is implied.

    Used wherever diagrams, scenarios, figures, or example values are didactic constructions rather than sourced facts; every such use carries a simplifications disclosure. All people, companies, banks, and list entries in examples are fictional.

Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.