PERIOD_DIFF()

Overview

Returns the difference in months between two periods.

USAGE

PERIOD_DIFF(period1, period2)

Argument Name

Description

period

The two period arguments

DETAILS

PERIOD_DIFF() is a date-time function that returns the difference in months between two periods.

The return value is the number of months between the arguments, subtracting the second argument from the first.

Each period argument must be in the format YYYYMM or YYMM.

A NULL is returned if either argument is NULL.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SELECT PERIOD_DIFF(202002, 1902),
       PERIOD_DIFF(2002, 201902);
+---------------------------+---------------------------+
| PERIOD_DIFF(202002, 1902) | PERIOD_DIFF(2002, 201902) |
+---------------------------+---------------------------+
|                        12 |                        12 |
+---------------------------+---------------------------+

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES