Why MySQL uses the interval like 7 day and 2 hour instead of 7 days and 2 hours?

MySQLMySQLi Database

The reason behind this concept is that MySQL requires the unit keywords to be singular, regardless of the English grammar rules. If we will try to supply intervals like 7 days, 2 hours etc then MySQL will produce syntax error as follows −

mysql> Select '2017-02-25 05:04:30' + INTERVAL 2 days;
ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near 'days' at line 1
raja
Published on 19-Feb-2018 12:46:28
Advertisements