2010-11-29 20:13:16 +01:00
|
|
|
set @save_time_zone= @@time_zone;
|
|
|
|
set time_zone='+03:00';
|
2009-12-15 08:16:46 +01:00
|
|
|
CREATE TABLE t1(c1 TIMESTAMP NOT NULL, c2 TIMESTAMP NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1), UNIQUE INDEX(c2));
|
|
|
|
INSERT INTO t1 VALUES('98-12-31 11:30:45','98.12.31 11+30+45','98-12-31 11:30:45','98.12.31 11+30+45'),('98/12/30 11*30*45','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45'),('98-12-29','98.12.29','98-12-29','98.12.29'),('98/12/28','98@12@28','98/12/28','98@12@28');
|
|
|
|
Warnings:
|
|
|
|
Note 1265 Data truncated for column 'c3' at row 1
|
|
|
|
Note 1265 Data truncated for column 'c3' at row 2
|
|
|
|
INSERT INTO t1 VALUES('20070523091528','070523091528','20070524091528','070524091528'),('20070525','070525','20070526','070526');
|
|
|
|
Warnings:
|
|
|
|
Note 1265 Data truncated for column 'c3' at row 1
|
|
|
|
INSERT INTO t1 VALUES(19830905132800,830905132800,19830906132800,830906132800),(19830907,830907,19830908,830908);
|
|
|
|
Warnings:
|
|
|
|
Note 1265 Data truncated for column 'c3' at row 1
|
|
|
|
SET TIMESTAMP=1233216687;
|
|
|
|
INSERT INTO t1 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE);
|
|
|
|
Warnings:
|
|
|
|
Note 1265 Data truncated for column 'c3' at row 1
|
|
|
|
INSERT INTO t1 VALUES('2008-01-01',NULL,'08-01-02','08/01/03');
|
|
|
|
INSERT INTO t1(c1,c2) VALUES('08/01/17',NULL);
|
|
|
|
DELETE FROM t1 WHERE c1='08/01/17' AND c2 IS NULL;
|
|
|
|
INSERT INTO t1 VALUES('','','08-01-04','08/01/05') /* Inserts zero dates for '' strings */;
|
|
|
|
Warnings:
|
|
|
|
Warning 1265 Data truncated for column 'c1' at row 1
|
|
|
|
Warning 1265 Data truncated for column 'c2' at row 1
|
|
|
|
INSERT INTO t1 VALUES('1971-01-01 00:00:01','1980-01-01 00:00:01','2009-01-01','2009-01-02'),('1990-01-01 00:00:01','2000-01-01 00:00:01','2009-01-03','2009-01-04'),('2038-01-09 03:14:07','2038-01-09 03:14:07','2009-01-05','2009-01-06');
|
|
|
|
SELECT * FROM t1;
|
|
|
|
c1 c2 c3 c4
|
|
|
|
0000-00-00 00:00:00 0000-00-00 00:00:00 2008-01-04 2008-01-05 00:00:00
|
|
|
|
1971-01-01 00:00:01 1980-01-01 00:00:01 2009-01-01 2009-01-02 00:00:00
|
|
|
|
1983-09-05 13:28:00 1983-09-05 13:28:00 1983-09-06 1983-09-06 13:28:00
|
|
|
|
1983-09-07 00:00:00 1983-09-07 00:00:00 1983-09-08 1983-09-08 00:00:00
|
|
|
|
1990-01-01 00:00:01 2000-01-01 00:00:01 2009-01-03 2009-01-04 00:00:00
|
|
|
|
1998-12-28 00:00:00 1998-12-28 00:00:00 1998-12-28 1998-12-28 00:00:00
|
|
|
|
1998-12-29 00:00:00 1998-12-29 00:00:00 1998-12-29 1998-12-29 00:00:00
|
|
|
|
1998-12-30 11:30:45 1998-12-30 11:30:45 1998-12-30 1998-12-30 11:30:45
|
|
|
|
1998-12-31 11:30:45 1998-12-31 11:30:45 1998-12-31 1998-12-31 11:30:45
|
|
|
|
2007-05-23 09:15:28 2007-05-23 09:15:28 2007-05-24 2007-05-24 09:15:28
|
|
|
|
2007-05-25 00:00:00 2007-05-25 00:00:00 2007-05-26 2007-05-26 00:00:00
|
|
|
|
2008-01-01 00:00:00 NULL 2008-01-02 2008-01-03 00:00:00
|
|
|
|
2009-01-29 11:11:27 2009-01-29 00:00:00 2009-01-29 2009-01-29 00:00:00
|
|
|
|
2038-01-09 03:14:07 2038-01-09 03:14:07 2009-01-05 2009-01-06 00:00:00
|
|
|
|
SELECT * FROM t1 WHERE c1 BETWEEN '0000-00-00' AND '2010-00-01 00:00:00' ORDER BY c1 DESC LIMIT 2;
|
|
|
|
c1 c2 c3 c4
|
|
|
|
2009-01-29 11:11:27 2009-01-29 00:00:00 2009-01-29 2009-01-29 00:00:00
|
|
|
|
2008-01-01 00:00:00 NULL 2008-01-02 2008-01-03 00:00:00
|
|
|
|
SELECT * FROM t1 WHERE c2 BETWEEN '1971-01-01 00:00:01' AND '2010-10-00 00:00:00' ORDER BY c2 DESC LIMIT 2;
|
|
|
|
c1 c2 c3 c4
|
|
|
|
2009-01-29 11:11:27 2009-01-29 00:00:00 2009-01-29 2009-01-29 00:00:00
|
|
|
|
2007-05-25 00:00:00 2007-05-25 00:00:00 2007-05-26 2007-05-26 00:00:00
|
|
|
|
DROP TABLE t1;
|
2010-11-29 20:13:16 +01:00
|
|
|
set time_zone= @save_time_zone;
|