Which rows should survive?
Filtering defines the population every later operation sees. Learn inclusive boundaries, membership, pattern matching, and three-valued null logic together: a predicate that becomes unknown can remove rows you expected to keep.
Decision reference
| Need | Construct and check |
|---|---|
| Inclusive range | BETWEEN; both boundaries included |
| Whole timestamp day | >= start AND < next start |
| Membership | IN; check null semantics |
| Missing values | IS NULL / IS NOT NULL |
| Conditional expression | CASE; decide ELSE behavior |
| Text match | LIKE / ILIKE / regex; dialect and pattern semantics |
In this chapter
- BETWEEN, IN & pattern matchingFilter ranges, alternatives, and text without boundary mistakes.
- NULL, CASE & conditional expressionsReason about unknown values and express conditional logic.
Try breaking the predicate
Test the same filter with a boundary value, a null, and a timestamp near midnight. If one of those changes the population unexpectedly, the predicate needs another look.