---
title: make_interval function
description: Learn the syntax of the make\_interval function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/make_interval
---

# `make_interval` function

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime

Creates an interval from `years`, `months`, `weeks`, `days`, `hours`, `mins` and `secs`.

> [!WARNING]
>
> This constructor is deprecated since it generates an `INTERVAL` which cannot be compared or operated upon. Please use [make\_ym\_interval](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_ym_interval.md) or [make\_dt\_interval](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_dt_interval.md) to produce intervals.

## Syntax

```
make_interval( [years [, months [, weeks [, days [, hours [, mins [, secs] ] ] ] ] ] ] )
```

## Arguments

* `years`: An optional integral number of years, positive or negative.
* `months`: An optional integral number of months, positive or negative.
* `weeks`: An optional integral number of weeks, positive or negative.
* `days`: An optional integral number of days, positive or negative.
* `hours`: An optional integral number of hours, positive or negative.
* `mins`: An optional integral number of minutes, positive or negative.
* `secs`: An optional number of seconds with the fractional part in microsecond precision.

## Returns

An `INTERVAL`.

Unspecified arguments default to `0`.

If the result overflows, Databricks raises [ARITHMETIC\_OVERFLOW](https://docs.databricks.com/aws/en/error-messages/arithmetic-overflow-error-class.md).

Use [try\_make\_interval](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_make_interval.md) to return `NULL` on overflow.

## Common error conditions

* [ARITHMETIC\_OVERFLOW](https://docs.databricks.com/aws/en/error-messages/arithmetic-overflow-error-class.md)

## Examples

```sql
> SELECT make_interval(100, 11);
 100 years 11 months
> SELECT make_interval(100, null);
 NULL
> SELECT make_interval();
 0 seconds
> SELECT make_interval(0, 0, 1, 1, 12, 30, 01.001001);
 8 days 12 hours 30 minutes 1.001001 seconds

> SELECT make_interval(2147483647, 0);
 Error: ARITHMETIC_OVERFLOW
```

## Related functions

* [`make_dt_interval` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_dt_interval.md)
* [`make_date` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_date.md)
* [`make_timestamp` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_timestamp.md)
* [`make_ym_interval` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/make_ym_interval.md)
* [`try_make_interval` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_make_interval.md)
