What are the different ways in MySQL to add ‘half year interval’ in date?


We can add ‘half year interval’ in date ith the following ways −

(A) By adding interval of 6 Months

mysql> Select '2017-06-20' + INTERVAL 6 Month AS 'After Half Year Interval';
+--------------------------+
| After Half Year Interval |
+--------------------------+
|  2017-12-20              |
+--------------------------+
1 row in set (0.00 sec)

(B) By adding interval of 2 quarters

mysql> Select '2017-06-20' + INTERVAL 2 Quarter AS 'After Half Year Interval';
+--------------------------+
| After Half Year Interval |
+--------------------------+
| 2017-12-20               |
+--------------------------+
1 row in set (0.00 sec)

Above query will add half year interval in date with the help of Quarter keyword.

Updated on: 29-Jan-2020

369 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements