Home > Database > Mysql Tutorial > What will MySQL return if I use a closed unit value set with the INTERVAL keyword?

What will MySQL return if I use a closed unit value set with the INTERVAL keyword?

WBOY
Release: 2023-08-29 14:01:02
forward
979 people have browsed it

如果我使用带有 INTERVAL 关键字的封闭单位值集,MySQL 将返回什么?

In this case, MySQL will consider the first of the two values ​​provided in the accompanying unit value set. It returns output, along with warnings, after calculating the interval based on the values ​​considered in the closed set, in the units given in the INTERVAL keyword.

The following examples will clarify this -

mysql> Select TIMESTAMP('2017-10-22 04:05:36' + INTERVAL '4 2' Hour)AS 'HOUR VALUE INCREASED BY 4';
+---------------------------+
| HOUR VALUE INCREASED BY 4 |
+---------------------------+
| 2017-10-22 08:05:36       |
+---------------------------+
1 row in set, 1 warning (0.00 sec)

mysql> Show warnings;
+---------+------+------------------------------------------+
| Level   | Code | Message                                  |
+---------+------+------------------------------------------+
| Warning | 1292 | Truncated incorrect INTEGER value: '4 2' |
+---------+------+------------------------------------------+
1 row in set (0.00 sec)
Copy after login

The above is the detailed content of What will MySQL return if I use a closed unit value set with the INTERVAL keyword?. 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