make_ym_interval
function
Applies to: Databricks SQL Databricks Runtime 10.4 LTS and above
Creates an year-month interval from years
and months
.
Arguments
years
: An integral number of years, positive or negativemonths
: An integral number of months, positive or negative
Returns
An INTERVAL YEAR TO MONTH
.
Unspecified arguments are defaulted to 0.
If you provide no arguments the result is an INTERVAL '0-0' YEAR TO MONTH
.
The function is equivalent to executing:
INTERVAL year YEARS + INTERVAL month MONTHS
.
As such each unit can be outside of its natural range as well as negative.