diff --git a/documentation/query/operators/date-time.md b/documentation/query/operators/date-time.md index 342e37449..a59d1498a 100644 --- a/documentation/query/operators/date-time.md +++ b/documentation/query/operators/date-time.md @@ -101,7 +101,8 @@ WHERE ts IN interval($1, $2); ## `BETWEEN` ... `AND` The `BETWEEN` operator specifies an inclusive range. Useful when working with -dynamic bounds from functions. +dynamic bounds from functions. It takes timestamps (integer columns also work); +for `DOUBLE`, `FLOAT`, `DECIMAL` or `VARCHAR` ranges, use `>=` and `<=`. :::tip diff --git a/documentation/query/sql/where.md b/documentation/query/sql/where.md index 71f6fd288..049b6c374 100644 --- a/documentation/query/sql/where.md +++ b/documentation/query/sql/where.md @@ -437,6 +437,15 @@ SELECT * FROM trades WHERE timestamp IN '$now-1y..$now'; ``` +`BETWEEN` is a timestamp operator. It also accepts integer columns, but +`DOUBLE`, `FLOAT`, `DECIMAL` and `VARCHAR` columns fail with +``there is no matching operator `between` ``. For those, use comparison operators: + +```questdb-sql title="Numeric range" +SELECT * FROM trades +WHERE price >= 60000 AND price <= 70000; +``` + ##### Inclusivity example Inclusivity is precise, and may be more granular than the provided dates appear.