Query OK, 1 row affected (0.00 sec)
mysql
INSERT INTO test_time VALUES, "35 13:25:59");Query OK, 1
row affected, 1 warning (0.00 sec)
mysql
SHOW WARNINGS;+---------+------+----------------------------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------------------------+
| Warning | 1264 | Out of range value adjusted for column 'mytime' at row 1 |
+---------+------+----------------------------------------------------------+
1 row inset sec)
mysql
INSERT INTO test_time VALUES, "-35 13:25:59");Query OK, 1 row affected, 1 warning (0.00 sec)
mysql
INSERT INTO test_time VALUES, "35 13:25:69");Query OK, 1 row affected, 1 warning (0.00 sec)
mysql
SHOW WARNINGS;+---------+------+---------------------------------------------+
| Level | Code | Message |
+---------+------+---------------------------------------------+
| Warning | 1265 | Data truncated for column 'mytime' at row 1 |
+---------+------+---------------------------------------------+
1 row inset sec)
mysql
SELECT * FROM test_time;+----+------------+
| id | mytime |
+----+------------+
| 1 | 61:25:59 |
| 2 | 838:59:59 |
| 3 | -838:59:59 |
| 4 | 00:00:00 |
+----+------------+
4 rows inset sec)
Note how the out-of-range and invalid times are stored.
H:M:S,
and single, double, and triple-digit combinations
You can use different combinations of digits when
inserting or updating data;
MySQL converts them into the internal time format and displays them consistently. For example,
is equivalent to 01:01:03
. Different numbers of digits can be mixed for example, is equivalent to
01:12:03
. Consider these examples:
mysql>
CREATE TABLE mytime (testtime TIME);Query OK, 0 rows affected (0.12 sec)
mysql>
INSERT INTO mytime VALUESShare with your friends: