--- title: Range Term --- `range_term` is the equivalent of Postgres' operators over [range types](https://www.postgresql.org/docs/current/rangetypes.html). It supports operations like range containment, overlap, and intersection. ## Term Within In this example, `weight_range` is an `int4range` type. The following query finds all rows where `weight_range` contains `1`: ```sql SELECT id, weight_range FROM mock_items WHERE weight_range @@@ pdb.range_term(1); ``` ## Range Intersects The following query finds all ranges that share at least one common point with the query range: ```sql SELECT id, weight_range FROM mock_items WHERE weight_range @@@ pdb.range_term('(10, 12]'::int4range, 'Intersects'); ``` ## Range Contains The following query finds all ranges that are contained by the query range: ```sql SELECT id, weight_range FROM mock_items WHERE weight_range @@@ pdb.range_term('(3, 9]'::int4range, 'Contains'); ``` ## Range Within The following query finds all ranges that contain the query range: ```sql SELECT id, weight_range FROM mock_items WHERE weight_range @@@ pdb.range_term('(2, 11]'::int4range, 'Within'); ```