make_interval function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime

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


This constructor is deprecated since it generates an INTERVAL which cannot be compared or operated upon. Please use make_ym_interval or make_dt_interval to produce intervals.


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


  • years: An integral number of years, positive or negative

  • months: An integral number of months, positive or negative

  • weeks: An integral number of weeks, positive or negative

  • days: An integral number of days, positive or negative

  • hours: An integral number of hours, positive or negative

  • mins: An integral number of minutes, positive or negative

  • secs: A number of seconds with the fractional part in microsecond precision.



Unspecified arguments are defaulted to 0. If you provide no arguments the result is an INTERVAL with 0 seconds.


> SELECT make_interval(100, 11);
 100 years 11 months
> SELECT make_interval(100, 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