1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
DROP TABLE IF EXISTS t1,t2,t3;
SET TIME_ZONE="+03:00";
CREATE TABLE t1(c1 DATE NOT NULL PRIMARY KEY);
SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1) VALUES(NOW());
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'1 01:01:01'));
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'2 02:01:01'));
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'3 03:01:01'));
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'4 04:01:01'));
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
SELECT * FROM t1 ORDER BY c1;
c1
2007-02-13
2007-02-14
2007-02-15
2007-02-16
2007-02-17
DELETE FROM t1 WHERE c1 <= ADDTIME(NOW(),'2 02:01:01');
SELECT * FROM t1 ORDER BY c1;
c1
2007-02-16
2007-02-17
DROP TABLE t1;
CREATE TABLE t1(c1 TIME NOT NULL PRIMARY KEY);
SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1) VALUES(NOW());
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'1 01:01:01'));
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'2 02:01:01'));
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'3 03:01:01'));
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'4 04:01:01'));
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
SELECT * FROM t1 ORDER BY c1;
c1
09:09:33
10:10:34
11:10:34
12:10:34
13:10:34
DELETE FROM t1 WHERE c1 <= ADDTIME(NOW(),'2 02:01:01');
SELECT * FROM t1 ORDER BY c1;
c1
DROP TABLE t1;
CREATE TABLE t1(c1 DATETIME NOT NULL PRIMARY KEY);
SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1) VALUES(NOW());
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'1 01:01:01'));
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'2 02:01:01'));
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'3 03:01:01'));
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'4 04:01:01'));
SELECT * FROM t1 ORDER BY c1;
c1
2007-02-13 09:09:33
2007-02-14 10:10:34
2007-02-15 11:10:34
2007-02-16 12:10:34
2007-02-17 13:10:34
DELETE FROM t1 WHERE c1 <= ADDTIME(NOW(),'2 02:01:01');
SELECT * FROM t1 ORDER BY c1;
c1
2007-02-16 12:10:34
2007-02-17 13:10:34
DROP TABLE t1;
CREATE TABLE t1(c1 TIMESTAMP NOT NULL PRIMARY KEY);
SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1) VALUES(NOW());
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'1 01:01:01'));
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'2 02:01:01'));
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'3 03:01:01'));
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'4 04:01:01'));
SELECT * FROM t1 ORDER BY c1;
c1
2007-02-13 09:09:33
2007-02-14 10:10:34
2007-02-15 11:10:34
2007-02-16 12:10:34
2007-02-17 13:10:34
DELETE FROM t1 WHERE c1 <= ADDTIME(NOW(),'2 02:01:01');
SELECT * FROM t1 ORDER BY c1;
c1
2007-02-16 12:10:34
2007-02-17 13:10:34
DROP TABLE t1;
SET TIME_ZONE= @@global.time_zone;
|