Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion documentation/query/operators/date-time.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 9 additions & 0 deletions documentation/query/sql/where.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading