1SET DEFAULT_STORAGE_ENGINE='tokudb';
2drop table if exists t1;
3create table t1 (t time);
4insert 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");
5Warnings:
6Note	1265	Data truncated for column 't' at row 13
7insert t1 values (30),(1230),("1230"),("12:30"),("12:30:35"),("1 12:30:31.32");
8select * from t1;
9t
1010:22:33
1112:34:56
1200:00:10
1300:12:34
1412:34:56
15123:45:59
1600:00:01
1701:23:00
1801:23:45
1900:00:10
20-241:22:33
21490:22:33
2220:33:34
2300:00:30
2400:12:30
2500:12:30
2612:30:00
2712:30:35
2836:30:31
29insert into t1 values("10.22.22"),(1234567),(123456789),(123456789.10),("10 22:22"),("12.45a");
30Warnings:
31Warning	1265	Data truncated for column 't' at row 1
32Warning	1265	Data truncated for column 't' at row 2
33Warning	1265	Data truncated for column 't' at row 3
34Warning	1265	Data truncated for column 't' at row 4
35Warning	1265	Data truncated for column 't' at row 6
36select * from t1;
37t
3810:22:33
3912:34:56
4000:00:10
4100:12:34
4212:34:56
43123:45:59
4400:00:01
4501:23:00
4601:23:45
4700:00:10
48-241:22:33
49490:22:33
5020:33:34
5100:00:30
5200:12:30
5300:12:30
5412:30:00
5512:30:35
5636:30:31
5700:00:10
5800:00:00
5900:00:00
6000:00:00
61262:22:00
6200:00:12
63drop table t1;
64create table t1 (t time);
65insert 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');
66select t, time_to_sec(t),sec_to_time(time_to_sec(t)) from t1;
67t	time_to_sec(t)	sec_to_time(time_to_sec(t))
6809:00:00	32400	09:00:00
6913:00:00	46800	13:00:00
7019:38:34	70714	19:38:34
7113:00:00	46800	13:00:00
7209:00:00	32400	09:00:00
7309:00:00	32400	09:00:00
7413:00:00	46800	13:00:00
7513:00:00	46800	13:00:00
7613:00:00	46800	13:00:00
7709:00:00	32400	09:00:00
78select sec_to_time(time_to_sec(t)) from t1;
79sec_to_time(time_to_sec(t))
8009:00:00
8113:00:00
8219:38:34
8313:00:00
8409:00:00
8509:00:00
8613:00:00
8713:00:00
8813:00:00
8909:00:00
90drop table t1;
91select cast('100:55:50' as time) < cast('24:00:00' as time);
92cast('100:55:50' as time) < cast('24:00:00' as time)
930
94select cast('100:55:50' as time) < cast('024:00:00' as time);
95cast('100:55:50' as time) < cast('024:00:00' as time)
960
97select cast('300:55:50' as time) < cast('240:00:00' as time);
98cast('300:55:50' as time) < cast('240:00:00' as time)
990
100select cast('100:55:50' as time) > cast('24:00:00' as time);
101cast('100:55:50' as time) > cast('24:00:00' as time)
1021
103select cast('100:55:50' as time) > cast('024:00:00' as time);
104cast('100:55:50' as time) > cast('024:00:00' as time)
1051
106select cast('300:55:50' as time) > cast('240:00:00' as time);
107cast('300:55:50' as time) > cast('240:00:00' as time)
1081
109create table t1 (f1 time);
110insert into t1 values ('24:00:00');
111select cast('24:00:00' as time) = (select f1 from t1);
112cast('24:00:00' as time) = (select f1 from t1)
1131
114drop table t1;
115create table t1(f1 time, f2 time);
116insert into t1 values('20:00:00','150:00:00');
117select 1 from t1 where cast('100:00:00' as time) between f1 and f2;
1181
1191
120drop table t1;
121CREATE TABLE  t1 (
122f2 date NOT NULL,
123f3 int(11) unsigned NOT NULL default '0',
124PRIMARY KEY  (f3, f2)
125);
126insert into t1 values('2007-07-01', 1);
127insert into t1 values('2007-07-01', 2);
128insert into t1 values('2007-07-02', 1);
129insert into t1 values('2007-07-02', 2);
130SELECT sum(f3) FROM t1 where f2='2007-07-01 00:00:00' group by f2;
131sum(f3)
1323
133drop table t1;
134