Skip to content

Numeric Filters

Goal: Filter by numbers — comparison, range (BETWEEN), and a few common pitfalls.


Operators

Operator Meaning
= Equals
<> Not equals
<, > Less than, greater than
<=, >= Inclusive
BETWEEN x AND y Inclusive range
NOT BETWEEN x AND y Outside range

Examples

POP > 100000
ELEV >= 1500
PRICE < 250000
DISTANCE_M <= 500
DENSITY <> 0

BETWEEN

BETWEEN is inclusive on both ends:

POP BETWEEN 10000 AND 50000
-- equivalent to:
POP >= 10000 AND POP <= 50000
Use Range
POP BETWEEN 10000 AND 50000 10000 ≤ POP ≤ 50000
POP NOT BETWEEN 10000 AND 50000 POP < 10000 OR POP > 50000

No quotes for numbers

Numeric fields take no quotes:

POP > 100000          -- ✅
POP > '100000'        -- ❌ string compare → unpredictable

Float comparison

For floating-point fields, exact equality is risky:

NDVI = 0.5            -- ⚠ usually fails — actual value might be 0.4999999
NDVI BETWEEN 0.49 AND 0.51    -- ✅ safer

Negative numbers

ELEV_DIFF < -100
TEMP_C BETWEEN -10 AND 10

No special syntax — minus sign is part of the literal.

Combining

POP > 100000 AND DENSITY > 1000
ELEV BETWEEN 500 AND 1500 AND SLOPE < 10

NULL with numerics

A NULL value will not match any numeric comparison:

POP > 0               -- NULL POP rows are excluded

To include NULL:

POP > 0 OR POP IS NULL

To find rows where POP isn't yet captured:

POP IS NULL OR POP = 0

Real-world examples

Census tracts in a population range

POP2020 BETWEEN 2000 AND 8000

High-income above median

MEDIAN_INC > 80000

Acres per parcel range

ACRES BETWEEN 0.25 AND 2.5

Significant elevation

ELEV_M >= 1000 AND ELEV_M < 3000

Negative growth

POP_CHANGE_PCT < 0

Only large parcels (with NULL handling)

ACRES > 100 OR ACRES IS NULL

Calculated thresholds

Sometimes you don't know the exact threshold but you know the relationship to another field:

ENROLLMENT > CAPACITY              -- over-capacity
PRICE < AVG_PRICE                  -- below average (assuming AVG_PRICE field exists)
GROWTH > BASELINE * 1.1            -- 10% above baseline

Multiple ranges

(POP BETWEEN 5000 AND 10000)
   OR (POP BETWEEN 20000 AND 50000)

Common mistakes

Avoid

  • 🚫 POP > '100000' (quoted number → string compare)
  • 🚫 NDVI = 0.5 (float equality)
  • 🚫 Forgetting NULLs in < / > queries
  • 🚫 BETWEEN 100 AND 50 (inverted range — returns nothing)

Practice

Numeric drills

  1. Cities with population between 50,000 and 200,000.
  2. Parcels under $100,000 or over $1 million.
  3. Elevations in 1000–3000 m, slope < 15.
  4. Tracts with negative population change.
  5. Buffers with DIST_M > 0 (i.e., actual buffers, not zero-width).

→ Next: Text Filters.