---
title: between predicate
description: Learn the syntax of the between predicate of the SQL language in Databricks SQL.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/between
---

# `between` predicate

Tests whether `expr1` is greater or equal than `expr2` and less than or equal to `expr3`.

## Syntax

```
expr1 [not] between expr2 and expr3
```

## Arguments

* `expr1`: An expression of any comparable type.
* `expr2`: An expression that shares a [least common type](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-datatype-rules.md#least-common-type-resolution) with all other arguments.
* `expr3`: An expression that shares a [least common type](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-datatype-rules.md#least-common-type-resolution) with all other arguments.

## Returns

The results is a `BOOLEAN`.

If `not` is specified the function is a synonym for `expr1 < expr2 or expr1 > expr3`.

Without `not` the function is a synonym for `expr1 >= expr2 and expr1 <= expr3`.

## Examples

```sql
> SELECT 4 between 3 and 5;
 true

> SELECT 4 not between 3 and 5;
 false

> SELECT 4 not between NULL and 5;
 NULL
```

## Related

* [`in` predicate](https://docs.databricks.com/aws/en/sql/language-manual/functions/in.md)
* [`and` predicate](https://docs.databricks.com/aws/en/sql/language-manual/functions/and.md)
* [SQL data type rules](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-datatype-rules.md)
