MySQL PERIOD_ADD Function

MySQL PERIOD_ADD function is one of the MySQL Date Functions, which is to add the number of months to a given period. This MySQL Period add function to adds the required months to a given period and returns the output as YYYYMM format. The basic syntax of the PERIOD_ADD() Function in MySQL is as shown below:

PERIOD_ADD(Period, Number_of_Months);

MySQL PERIOD_ADD function Example

This MySQL Period add function accepts either the YYYYMM or YYMM format value as the period argument. The following examples help you understand the use of this MySQL Period_add function. In this MySQL example, we are adding 3, 4, 6 months to the year 2019 and Month 01 and 06.

SELECT PERIOD_ADD(201901, 3);

SELECT PERIOD_ADD(201906, 4);

SELECT PERIOD_ADD(201906, 6);
MySQL PERIOD_ADD Function 1

Let us see another example of the MySQL Period add function. Here, we are using the Period as YYMM format. In this Date Function example in MySQL, 95 means 1995, and 19 means 2019

SELECT PERIOD_ADD(9504, 6);

SELECT PERIOD_ADD(1905, 6);

SELECT PERIOD_ADD(1905, 11);
MySQL PERIOD_ADD Function 2