Home > Database > Mysql Tutorial > body text

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

WBOY
Release: 2023-08-31 12:05:06
forward
1088 people have browsed it

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
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template