Home  >  Article  >  Database  >  Why does MySQL use an interval of 7 days and 2 hours instead of 7 days and 2 hours?

Why does MySQL use an interval of 7 days and 2 hours instead of 7 days and 2 hours?

WBOY
WBOYforward
2023-08-31 12:05:061094browse

Why does MySQL use an interval of 7 days and 2 hours instead of 7 days and 2 hours?

The reason behind this concept is that MySQL requires the unit keyword to be singular, regardless of English grammar rules. If we try to provide intervals of 7 days, 2 hours, etc. then MySQL will generate a syntax error as shown below -

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

The above is the detailed content of Why does MySQL use an interval of 7 days and 2 hours instead of 7 days and 2 hours?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete