Different Ways to Add Half-Year Interval in MySQL 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: 2020-01-29T06:36:20+05:30

556 Views

Kickstart Your Career

Get certified by completing the course

Get Started