MySQL PERIOD_ADD Function

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

PERIOD_ADD(Period, Number_of_Months);

MySQL PERIOD_ADD function Example

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

SELECT PERIOD_ADD(201901, 3);

SELECT PERIOD_ADD(201906, 4);

SELECT PERIOD_ADD(201906, 6);
 PERIOD_ADD Example 1

Let us see another example of the Period add function. Here, we are using the Period as YYMM format. In this Date method 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 Example 2