Memra

Pattern matching with LIKE

Match text by shape, not exact value.

Match by pattern

LIKE matches text against a pattern with two wildcards:

- % — any run of characters (including none) - _ — exactly one character

SELECT title FROM books WHERE title LIKE 'The %';

That finds titles starting with "The ". '%light' ends with "light"; '%a%' contains an "a". In Postgres, LIKE is case-sensitive — use ILIKE for case-insensitive matching.

NORMAL ~/memra/learn/postgresql/pattern-matching-like utf-8 LF