1
drop table if exists t1;
2
create table t1 (t time);
3
insert into t1 values("10:22:33"),("12:34:56.78"),(10),(1234),(123456.78),(1234559.99),("1"),("1:23"),("1:23:45"), ("10.22"), ("-10 1:22:33.45"),("20 10:22:33"),("1999-02-03 20:33:34");
4
insert t1 values (30),(1230),("1230"),("12:30"),("12:30:35"),("1 12:30:31.32");
26
insert into t1 values("10.22.22"),(1234567),(123456789),(123456789.10),("10 22:22"),("12.45a");
28
Warning 1265 Data truncated for column 't' at row 1
29
Warning 1264 Out of range value for column 't' at row 2
30
Warning 1264 Out of range value for column 't' at row 3
31
Warning 1264 Out of range value for column 't' at row 4
32
Warning 1265 Data truncated for column 't' at row 6
61
create table t1 (t time);
62
insert into t1 values ('09:00:00'),('13:00:00'),('19:38:34'), ('13:00:00'),('09:00:00'),('09:00:00'),('13:00:00'),('13:00:00'),('13:00:00'),('09:00:00');
63
select t, time_to_sec(t),sec_to_time(time_to_sec(t)) from t1;
64
t time_to_sec(t) sec_to_time(time_to_sec(t))
65
09:00:00 32400 09:00:00
66
13:00:00 46800 13:00:00
67
19:38:34 70714 19:38:34
68
13:00:00 46800 13:00:00
69
09:00:00 32400 09:00:00
70
09:00:00 32400 09:00:00
71
13:00:00 46800 13:00:00
72
13:00:00 46800 13:00:00
73
13:00:00 46800 13:00:00
74
09:00:00 32400 09:00:00
75
select sec_to_time(time_to_sec(t)) from t1;
76
sec_to_time(time_to_sec(t))
88
select cast('100:55:50' as time) < cast('24:00:00' as time);
89
cast('100:55:50' as time) < cast('24:00:00' as time)
91
select cast('100:55:50' as time) < cast('024:00:00' as time);
92
cast('100:55:50' as time) < cast('024:00:00' as time)
94
select cast('300:55:50' as time) < cast('240:00:00' as time);
95
cast('300:55:50' as time) < cast('240:00:00' as time)
97
select cast('100:55:50' as time) > cast('24:00:00' as time);
98
cast('100:55:50' as time) > cast('24:00:00' as time)
100
select cast('100:55:50' as time) > cast('024:00:00' as time);
101
cast('100:55:50' as time) > cast('024:00:00' as time)
103
select cast('300:55:50' as time) > cast('240:00:00' as time);
104
cast('300:55:50' as time) > cast('240:00:00' as time)
106
create table t1 (f1 time);
107
insert into t1 values ('24:00:00');
108
select cast('24:00:00' as time) = (select f1 from t1);
109
cast('24:00:00' as time) = (select f1 from t1)
112
create table t1(f1 time, f2 time);
113
insert into t1 values('20:00:00','150:00:00');
114
select 1 from t1 where cast('100:00:00' as time) between f1 and f2;
120
f3 int(11) unsigned NOT NULL default '0',
123
insert into t1 values('2007-07-01', 1);
124
insert into t1 values('2007-07-01', 2);
125
insert into t1 values('2007-07-02', 1);
126
insert into t1 values('2007-07-02', 2);
127
SELECT sum(f3) FROM t1 where f2='2007-07-01 00:00:00' group by f2;