make_interval
function
Applies to: Databricks SQL 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 or make_dt_interval to produce intervals.
Syntax
make_interval( [years [, months [, weeks [, days [, hours [, mins [, secs] ] ] ] ] ] ] )
Arguments
years
: An integral number of years, positive or negativemonths
: An integral number of months, positive or negativeweeks
: An integral number of weeks, positive or negativedays
: An integral number of days, positive or negativehours
: An integral number of hours, positive or negativemins
: An integral number of minutes, positive or negativesecs
: A number of seconds with the fractional part in microsecond precision.
Returns
An INTERVAL.
Unspecified arguments are defaulted to 0. If you provide no arguments the result is an INTERVAL with 0 seconds.
Examples
> 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