diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:24:36 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:24:36 +0000 |
commit | 06eaf7232e9a920468c0f8d74dcf2fe8b555501c (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/suite/engines/iuds/r/insert_year.result | |
parent | Initial commit. (diff) | |
download | mariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.tar.xz mariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/engines/iuds/r/insert_year.result')
-rw-r--r-- | mysql-test/suite/engines/iuds/r/insert_year.result | 6247 |
1 files changed, 6247 insertions, 0 deletions
diff --git a/mysql-test/suite/engines/iuds/r/insert_year.result b/mysql-test/suite/engines/iuds/r/insert_year.result new file mode 100644 index 00000000..8065f606 --- /dev/null +++ b/mysql-test/suite/engines/iuds/r/insert_year.result @@ -0,0 +1,6247 @@ +DROP TABLE IF EXISTS t1,t2,t3,t4; +CREATE TABLE t1(c1 YEAR(4) NOT NULL, c2 YEAR(4) NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1), UNIQUE INDEX(c2)); +CREATE TABLE t2(c1 YEAR(4) NOT NULL, c2 YEAR(4) NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1,c2)); +CREATE TABLE t3(c1 YEAR(4) NOT NULL, c2 YEAR(4) NULL, c3 DATE, c4 DATETIME, UNIQUE INDEX idx(c1,c2)); +CREATE TABLE t4(c1 YEAR(4) NOT NULL, c2 YEAR(4) NULL, c3 DATE, c4 DATETIME); +INSERT INTO t1 VALUES('1901','1901','98-12-31','98.12.31 11:30:45'),('1999','1999','98-12-30','98.12.30 11:30:45'),('2000','2000','98-12-29','98.12.29 11:30:45'),('2001','2001','98-12-28','98.12.28 11:30:45'),('2099','2099','98-12-27','98.12.27 11:30:45'),('2100','2100','98-12-26','98.12.26 11:30:45'),('2155','2155','98-12-26','98.12.26 11:30:45'); +INSERT INTO t2 VALUES('1901','1901','98-12-31','98.12.31 11:30:45'),('1999','1999','98-12-30','98.12.30 11:30:45'),('2000','2000','98-12-29','98.12.29 11:30:45'),('2001','2001','98-12-28','98.12.28 11:30:45'),('2099','2099','98-12-27','98.12.27 11:30:45'),('2100','2100','98-12-26','98.12.26 11:30:45'),('2155','2155','98-12-26','98.12.26 11:30:45'); +INSERT INTO t3 VALUES('1901','1901','98-12-31','98.12.31 11:30:45'),('1999','1999','98-12-30','98.12.30 11:30:45'),('2000','2000','98-12-29','98.12.29 11:30:45'),('2001','2001','98-12-28','98.12.28 11:30:45'),('2099','2099','98-12-27','98.12.27 11:30:45'),('2100','2100','98-12-26','98.12.26 11:30:45'),('2155','2155','98-12-26','98.12.26 11:30:45'); +INSERT INTO t4 VALUES('1901','1901','98-12-31','98.12.31 11:30:45'),('1999','1999','98-12-30','98.12.30 11:30:45'),('2000','2000','98-12-29','98.12.29 11:30:45'),('2001','2001','98-12-28','98.12.28 11:30:45'),('2099','2099','98-12-27','98.12.27 11:30:45'),('2100','2100','98-12-26','98.12.26 11:30:45'),('2155','2155','98-12-25','98.12.25 11:30:45'); +INSERT INTO t4 VALUES(1901,1901,'98-12-24','98.12.24 11:30:45'),(1999,1999,'98-12-23','98.12.23 11:30:45'),(2000,2000,'98-12-22','98.12.22 11:30:45'),(2001,2001,'98-12-21','98.12.21 11:30:45'),(2099,2099,'98-12-20','98.12.20 11:30:45'),(2100,2100,'98-12-19','98.12.19 11:30:45'),(2155,2155,'98-12-18','98.12.18 11:30:45'); +INSERT INTO t1 VALUES('20','20','98-12-16','98.12.16 11:30:45'),('40','40','98-12-15','98.12.15 11:30:45'),('60','60','98-12-14','98.12.14 11:30:45'),('69','69','98-12-13','98.12.13 11:30:45'),('70','70','98-12-12','98.12.12 11:30:45'),('90','90','98-12-11','98.12.11 11:30:45'); +INSERT INTO t2 VALUES('00','10','98-12-17','98.12.17 11:30:45'),('20','20','98-12-16','98.12.16 11:30:45'),('40','40','98-12-15','98.12.15 11:30:45'),('60','60','98-12-14','98.12.14 11:30:45'),('69','69','98-12-13','98.12.13 11:30:45'),('70','70','98-12-12','98.12.12 11:30:45'),('90','90','98-12-11','98.12.11 11:30:45'),('99','98','98-12-10','98.12.10 11:30:45'); +INSERT INTO t3 VALUES('00','10','98-12-17','98.12.17 11:30:45'),('20','20','98-12-16','98.12.16 11:30:45'),('40','40','98-12-15','98.12.15 11:30:45'),('60','60','98-12-14','98.12.14 11:30:45'),('69','69','98-12-13','98.12.13 11:30:45'),('70','70','98-12-12','98.12.12 11:30:45'),('90','90','98-12-11','98.12.11 11:30:45'),('99','98','98-12-10','98.12.10 11:30:45'); +INSERT INTO t4 VALUES('00','00','98-12-17','98.12.17 11:30:45'),('20','20','98-12-16','98.12.16 11:30:45'),('40','40','98-12-15','98.12.15 11:30:45'),('60','60','98-12-14','98.12.14 11:30:45'),('69','69','98-12-13','98.12.13 11:30:45'),('70','70','98-12-12','98.12.12 11:30:45'),('90','90','98-12-11','98.12.11 11:30:45'),('99','99','98-12-10','98.12.10 11:30:45'); +INSERT INTO t4 VALUES(1,1,'98-12-9','98.12.9 11:30:45'),(20,20,'98-12-8','98.12.8 11:30:45'),(40,40,'98-12-7','98.12.7 11:30:45'),(60,60,'98-12-6','98.12.6 11:30:45'),(69,69,'98-12-5','98.12.5 11:30:45'),(70,70,'98-12-4','98.12.4 11:30:45'),(90,90,'98-12-3','98.12.3 11:30:45'),(99,99,'98-12-2','98.12.2 11:30:45'); +SET TIMESTAMP=1233216687; +INSERT IGNORE INTO t1 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE); +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +Note 1265 Data truncated for column 'c3' at row 1 +INSERT IGNORE INTO t2 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE); +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +Note 1265 Data truncated for column 'c3' at row 1 +INSERT IGNORE INTO t3 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE); +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +Note 1265 Data truncated for column 'c3' at row 1 +INSERT IGNORE INTO t4 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE); +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +Note 1265 Data truncated for column 'c3' at row 1 +INSERT INTO t1(c1) VALUES('5'); +INSERT IGNORE INTO t2(c1) VALUES('5'); +Warnings: +Warning 1364 Field 'c2' doesn't have a default value +INSERT INTO t3(c1) VALUES('5'); +INSERT INTO t4(c1,c2) VALUES('0','000'); +INSERT IGNORE INTO t2 VALUES(1900,2156,'08-01-06','08/01/07'); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +INSERT IGNORE INTO t3 VALUES('1900','2156','08-01-08','08/1/9'); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +INSERT IGNORE INTO t4 VALUES('1900','2156','08-01-08','08/1/9'),(1900,2156,'08-01-08','08/1/9'),(0,00,'08-01-08','08/1/9'),(000,000,'08-01-08','08/1/9'),('-20','100','08-01-08','08/1/9'),(-20,100,'08-01-08','08/1/9'); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c1' at row 2 +Warning 1264 Out of range value for column 'c2' at row 2 +Warning 1264 Out of range value for column 'c1' at row 5 +Warning 1264 Out of range value for column 'c2' at row 5 +Warning 1264 Out of range value for column 'c1' at row 6 +Warning 1264 Out of range value for column 'c2' at row 6 +INSERT IGNORE INTO t1 VALUES('','','08-01-04','08/01/05') /* Inserts zero dates for '' strings */; +Warnings: +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1 +INSERT IGNORE INTO t4 VALUES('abcd','abcd','08-01-10','08/01/11'),(1234,1234,'08-01-12','08/01/13') /* Inserts zero dates for absurd dates */; +Warnings: +Warning 1366 Incorrect integer value: 'abcd' for column `test`.`t4`.`c1` at row 1 +Warning 1366 Incorrect integer value: 'abcd' for column `test`.`t4`.`c2` at row 1 +Warning 1264 Out of range value for column 'c1' at row 2 +Warning 1264 Out of range value for column 'c2' at row 2 +INSERT INTO t2 VALUES('20','30','98-12-16','98.12.16 11:30:45'),('40','20','98-12-15','98.12.15 11:30:45'); +INSERT INTO t3 VALUES('00','20','98-12-17','98.12.17 11:30:45'),('20','40','98-12-10','98.12.10 11:30:45'); +INSERT INTO t1 VALUES(80,NULL,'08-01-02','08/01/03'); +INSERT INTO t3 VALUES(80,NULL,'08-01-02','08/01/03'); +INSERT INTO t4 VALUES(80,NULL,'08-01-02','08/01/03'); +INSERT INTO t1(c1,c2) VALUES(1992,NULL); +SELECT * FROM t1; +c1 c2 c3 c4 +0000 0000 2008-01-04 2008-01-05 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1992 NULL NULL NULL +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t4; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +0000 0000 2008-01-08 2008-01-09 00:00:00 +0000 0000 2008-01-08 2008-01-09 00:00:00 +0000 0000 2008-01-08 2008-01-09 00:00:00 +0000 0000 2008-01-08 2008-01-09 00:00:00 +0000 0000 2008-01-08 2008-01-09 00:00:00 +0000 0000 2008-01-10 2008-01-11 00:00:00 +0000 0000 2008-01-12 2008-01-13 00:00:00 +1901 1901 1998-12-24 1998-12-24 11:30:45 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-04 1998-12-04 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-03 1998-12-03 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-02 1998-12-02 11:30:45 +1999 1999 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-23 1998-12-23 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-22 1998-12-22 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2000 NULL NULL +2001 2001 1998-12-09 1998-12-09 11:30:45 +2001 2001 1998-12-21 1998-12-21 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-08 1998-12-08 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-07 1998-12-07 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-06 1998-12-06 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-05 1998-12-05 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-20 1998-12-20 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-19 1998-12-19 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-18 1998-12-18 11:30:45 +2155 2155 1998-12-25 1998-12-25 11:30:45 +SELECT * FROM t2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t2; +total_rows min_value max(c1) +20 0 2155 +SELECT * FROM t2 WHERE c3 = '1998-12-11'; +c1 c2 c3 c4 +1990 1990 1998-12-11 1998-12-11 11:30:45 +SELECT c1,c2 FROM t2; +c1 c2 +0000 0000 +1901 1901 +1970 1970 +1990 1990 +1999 1998 +1999 1999 +2000 2000 +2000 2010 +2001 2001 +2005 0000 +2009 2009 +2020 2020 +2020 2030 +2040 2020 +2040 2040 +2060 2060 +2069 2069 +2099 2099 +2100 2100 +2155 2155 +SELECT c1,c2 FROM t2 ORDER BY c1,c2 DESC; +c1 c2 +0000 0000 +1901 1901 +1970 1970 +1990 1990 +1999 1999 +1999 1998 +2000 2010 +2000 2000 +2001 2001 +2005 0000 +2009 2009 +2020 2030 +2020 2020 +2040 2040 +2040 2020 +2060 2060 +2069 2069 +2099 2099 +2100 2100 +2155 2155 +SELECT * FROM t2 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 = '1901' ORDER BY c1,c2; +c1 c2 c3 c4 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 = '1901' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 = '1901' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 = '1901' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <> '1901' ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 <> '1901' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1970 1970 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t2 WHERE c1 > '1901' ORDER BY c1,c2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 > '1901' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +SELECT * FROM t2 WHERE c1 >= '1901' ORDER BY c1,c2; +c1 c2 c3 c4 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 >= '1901' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t2 WHERE c1 < '1901' ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +SELECT * FROM t2 WHERE c1 < '1901' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +SELECT * FROM t2 WHERE c1 <= '1901' ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <= '1901' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <=> '1901' ORDER BY c1,c2; +c1 c2 c3 c4 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <=> '1901' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 BETWEEN '1901' AND '2020' ORDER BY c1,c2; +c1 c2 c3 c4 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 BETWEEN '1901' AND '2020' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t2 WHERE c1 IN ('1901','2020') ORDER BY c1,c2; +c1 c2 c3 c4 +1901 1901 1998-12-31 1998-12-31 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 IN ('1901','2020') ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +1901 1901 1998-12-31 1998-12-31 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 >= '1901' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2; +c1 c2 c3 c4 +2009 2009 2009-01-29 2009-01-29 00:00:00 +SELECT * FROM t2 WHERE c1 >= '1901' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2009 2009 2009-01-29 2009-01-29 00:00:00 +SELECT * FROM t2 WHERE c1 IS NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 IS NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 IS NOT NULL ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 IS NOT NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <> '1901' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 <> '1901' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1970 1970 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t2 WHERE c1 > '1901' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 > '1901' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +SELECT * FROM t2 WHERE c1 >= '1901' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 >= '1901' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t2 WHERE c1 < '1901' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +SELECT * FROM t2 WHERE c1 < '1901' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +SELECT * FROM t2 WHERE c1 <= '1901' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <= '1901' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <=> '1901' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <=> '1901' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 BETWEEN '1901' AND '2020' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 BETWEEN '1901' AND '2020' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t2 WHERE c1 IN ('1901','2020') ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +1901 1901 1998-12-31 1998-12-31 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 IN ('1901','2020') ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +1901 1901 1998-12-31 1998-12-31 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 >= '1901' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2009 2009 2009-01-29 2009-01-29 00:00:00 +SELECT * FROM t2 WHERE c1 >= '1901' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2009 2009 2009-01-29 2009-01-29 00:00:00 +SELECT * FROM t2 WHERE c1 IS NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 IS NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t2; +total_rows min_value max(c1) +20 0 2155 +SELECT * FROM t2 WHERE c3 = '1998-12-11'; +c1 c2 c3 c4 +1990 1990 1998-12-11 1998-12-11 11:30:45 +SELECT c1,c2 FROM t2; +c1 c2 +0000 0000 +1901 1901 +1970 1970 +1990 1990 +1999 1998 +1999 1999 +2000 2000 +2000 2010 +2001 2001 +2005 0000 +2009 2009 +2020 2020 +2020 2030 +2040 2020 +2040 2040 +2060 2060 +2069 2069 +2099 2099 +2100 2100 +2155 2155 +SELECT c1,c2 FROM t2 ORDER BY c1,c2 DESC; +c1 c2 +0000 0000 +1901 1901 +1970 1970 +1990 1990 +1999 1999 +1999 1998 +2000 2010 +2000 2000 +2001 2001 +2005 0000 +2009 2009 +2020 2030 +2020 2020 +2040 2040 +2040 2020 +2060 2060 +2069 2069 +2099 2099 +2100 2100 +2155 2155 +SELECT * FROM t2 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 = '10' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 = '10' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 = '10' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 = '10' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 <> '10' ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 <> '10' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 > '10' ORDER BY c1,c2; +c1 c2 c3 c4 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 > '10' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 >= '10' ORDER BY c1,c2; +c1 c2 c3 c4 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 >= '10' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 < '10' ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +SELECT * FROM t2 WHERE c1 < '10' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <= '10' ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +SELECT * FROM t2 WHERE c1 <= '10' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <=> '10' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 <=> '10' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 BETWEEN '10' AND '2020' ORDER BY c1,c2; +c1 c2 c3 c4 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 BETWEEN '10' AND '2020' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 IN ('10','2020') ORDER BY c1,c2; +c1 c2 c3 c4 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 IN ('10','2020') ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 >= '10' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 >= '10' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 IS NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 IS NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 IS NOT NULL ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 IS NOT NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <> '10' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 <> '10' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 > '10' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 > '10' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 >= '10' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 >= '10' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 < '10' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +SELECT * FROM t2 WHERE c1 < '10' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <= '10' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +SELECT * FROM t2 WHERE c1 <= '10' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <=> '10' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 <=> '10' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 BETWEEN '10' AND '2020' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 BETWEEN '10' AND '2020' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 IN ('10','2020') ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 IN ('10','2020') ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 >= '10' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 >= '10' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 IS NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 IS NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t2; +total_rows min_value max(c2) +20 0 2155 +SELECT * FROM t2 WHERE c3 = '1998-12-11'; +c1 c2 c3 c4 +1990 1990 1998-12-11 1998-12-11 11:30:45 +SELECT c1,c2 FROM t2; +c1 c2 +0000 0000 +1901 1901 +1970 1970 +1990 1990 +1999 1998 +1999 1999 +2000 2000 +2000 2010 +2001 2001 +2005 0000 +2009 2009 +2020 2020 +2020 2030 +2040 2020 +2040 2040 +2060 2060 +2069 2069 +2099 2099 +2100 2100 +2155 2155 +SELECT c1,c2 FROM t2 ORDER BY c1,c2 DESC; +c1 c2 +0000 0000 +1901 1901 +1970 1970 +1990 1990 +1999 1999 +1999 1998 +2000 2010 +2000 2000 +2001 2001 +2005 0000 +2009 2009 +2020 2030 +2020 2020 +2040 2040 +2040 2020 +2060 2060 +2069 2069 +2099 2099 +2100 2100 +2155 2155 +SELECT * FROM t2 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c2 = 2155 ORDER BY c1,c2; +c1 c2 c3 c4 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 = 2155 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 = 2155 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 = 2155 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 <> 2155 ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 <> 2155 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c2 > 2155 ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 > 2155 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 >= 2155 ORDER BY c1,c2; +c1 c2 c3 c4 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 >= 2155 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 < 2155 ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 < 2155 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c2 <= 2155 ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 <= 2155 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c2 <=> 2155 ORDER BY c1,c2; +c1 c2 c3 c4 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 <=> 2155 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 BETWEEN '1970' AND 2155 ORDER BY c1,c2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 BETWEEN '1970' AND 2155 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +SELECT * FROM t2 WHERE c2 IN ('1970',2155) ORDER BY c1,c2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 IN ('1970',2155) ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 >= '1970' AND c2 < 2155 AND c1 = '1999' ORDER BY c1,c2; +c1 c2 c3 c4 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +SELECT * FROM t2 WHERE c2 >= '1970' AND c2 < 2155 AND c1 = '1999' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +SELECT * FROM t2 WHERE c2 IS NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NOT NULL ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 IS NOT NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c2 <> 2155 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 <> 2155 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c2 > 2155 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 > 2155 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 >= 2155 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 >= 2155 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 < 2155 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 < 2155 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c2 <= 2155 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 <= 2155 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c2 <=> 2155 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 <=> 2155 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 BETWEEN '1970' AND 2155 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 BETWEEN '1970' AND 2155 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +SELECT * FROM t2 WHERE c2 IN ('1970',2155) ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 IN ('1970',2155) ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 >= '1970' AND c2 < 2155 AND c1 = '1999' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +SELECT * FROM t2 WHERE c2 >= '1970' AND c2 < 2155 AND c1 = '1999' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +SELECT * FROM t2 WHERE c2 IS NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NOT NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t2; +total_rows min_value max(c2) +20 0 2155 +SELECT * FROM t2 WHERE c3 = '1998-12-11'; +c1 c2 c3 c4 +1990 1990 1998-12-11 1998-12-11 11:30:45 +SELECT c1,c2 FROM t2; +c1 c2 +0000 0000 +1901 1901 +1970 1970 +1990 1990 +1999 1998 +1999 1999 +2000 2000 +2000 2010 +2001 2001 +2005 0000 +2009 2009 +2020 2020 +2020 2030 +2040 2020 +2040 2040 +2060 2060 +2069 2069 +2099 2099 +2100 2100 +2155 2155 +SELECT c1,c2 FROM t2 ORDER BY c1,c2 DESC; +c1 c2 +0000 0000 +1901 1901 +1970 1970 +1990 1990 +1999 1999 +1999 1998 +2000 2010 +2000 2000 +2001 2001 +2005 0000 +2009 2009 +2020 2030 +2020 2020 +2040 2040 +2040 2020 +2060 2060 +2069 2069 +2099 2099 +2100 2100 +2155 2155 +SELECT * FROM t2 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c2 = NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 = NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 = NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 = NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <> NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <> NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 > NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 > NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 >= NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 >= NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 < NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 < NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <= NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <= NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <=> NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <=> NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 BETWEEN NULL AND '2069' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 BETWEEN NULL AND '2069' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IN (NULL,'2069') ORDER BY c1,c2; +c1 c2 c3 c4 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t2 WHERE c2 IN (NULL,'2069') ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t2 WHERE c2 >= NULL AND c2 < '2069' AND c1 = '2000' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 >= NULL AND c2 < '2069' AND c1 = '2000' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NOT NULL ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 IS NOT NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c2 <> NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <> NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 > NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 > NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 >= NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 >= NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 < NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 < NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <= NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <= NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <=> NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <=> NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 BETWEEN NULL AND '2069' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 BETWEEN NULL AND '2069' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IN (NULL,'2069') ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t2 WHERE c2 IN (NULL,'2069') ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t2 WHERE c2 >= NULL AND c2 < '2069' AND c1 = '2000' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 >= NULL AND c2 < '2069' AND c1 = '2000' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NOT NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 0000 NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2030 1998-12-16 1998-12-16 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2040 2020 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-06 2008-01-07 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t3; +total_rows min_value max(c1) +21 0 2155 +SELECT * FROM t3 WHERE c3 = '1998-12-11'; +c1 c2 c3 c4 +1990 1990 1998-12-11 1998-12-11 11:30:45 +SELECT c1,c2 FROM t3; +c1 c2 +0000 0000 +1901 1901 +1970 1970 +1980 NULL +1990 1990 +1999 1998 +1999 1999 +2000 2000 +2000 2010 +2000 2020 +2001 2001 +2005 NULL +2009 2009 +2020 2020 +2020 2040 +2040 2040 +2060 2060 +2069 2069 +2099 2099 +2100 2100 +2155 2155 +SELECT c1,c2 FROM t3 ORDER BY c1,c2 DESC; +c1 c2 +0000 0000 +1901 1901 +1970 1970 +1980 NULL +1990 1990 +1999 1999 +1999 1998 +2000 2020 +2000 2010 +2000 2000 +2001 2001 +2005 NULL +2009 2009 +2020 2040 +2020 2020 +2040 2040 +2060 2060 +2069 2069 +2099 2099 +2100 2100 +2155 2155 +SELECT * FROM t3 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 = '1970' ORDER BY c1,c2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c1 = '1970' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c1 = '1970' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c1 = '1970' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c1 <> '1970' ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 <> '1970' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 > '1970' ORDER BY c1,c2; +c1 c2 c3 c4 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 > '1970' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +SELECT * FROM t3 WHERE c1 >= '1970' ORDER BY c1,c2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 >= '1970' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +SELECT * FROM t3 WHERE c1 < '1970' ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 < '1970' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 <= '1970' ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c1 <= '1970' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 <=> '1970' ORDER BY c1,c2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c1 <=> '1970' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c1 BETWEEN '1970' AND '2020' ORDER BY c1,c2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +SELECT * FROM t3 WHERE c1 BETWEEN '1970' AND '2020' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +SELECT * FROM t3 WHERE c1 IN ('1970','2020') ORDER BY c1,c2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +SELECT * FROM t3 WHERE c1 IN ('1970','2020') ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t3 WHERE c1 >= '1970' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2; +c1 c2 c3 c4 +2009 2009 2009-01-29 2009-01-29 00:00:00 +SELECT * FROM t3 WHERE c1 >= '1970' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2009 2009 2009-01-29 2009-01-29 00:00:00 +SELECT * FROM t3 WHERE c1 IS NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NOT NULL ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 IS NOT NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 <> '1970' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 <> '1970' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 > '1970' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 > '1970' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +SELECT * FROM t3 WHERE c1 >= '1970' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 >= '1970' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +SELECT * FROM t3 WHERE c1 < '1970' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 < '1970' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 <= '1970' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c1 <= '1970' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 <=> '1970' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c1 <=> '1970' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c1 BETWEEN '1970' AND '2020' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t3 WHERE c1 BETWEEN '1970' AND '2020' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +SELECT * FROM t3 WHERE c1 IN ('1970','2020') ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t3 WHERE c1 IN ('1970','2020') ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +SELECT * FROM t3 WHERE c1 >= '1970' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2009 2009 2009-01-29 2009-01-29 00:00:00 +SELECT * FROM t3 WHERE c1 >= '1970' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2009 2009 2009-01-29 2009-01-29 00:00:00 +SELECT * FROM t3 WHERE c1 IS NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t3; +total_rows min_value max(c1) +21 0 2155 +SELECT * FROM t3 WHERE c3 = '1998-12-11'; +c1 c2 c3 c4 +1990 1990 1998-12-11 1998-12-11 11:30:45 +SELECT c1,c2 FROM t3; +c1 c2 +0000 0000 +1901 1901 +1970 1970 +1980 NULL +1990 1990 +1999 1998 +1999 1999 +2000 2000 +2000 2010 +2000 2020 +2001 2001 +2005 NULL +2009 2009 +2020 2020 +2020 2040 +2040 2040 +2060 2060 +2069 2069 +2099 2099 +2100 2100 +2155 2155 +SELECT c1,c2 FROM t3 ORDER BY c1,c2 DESC; +c1 c2 +0000 0000 +1901 1901 +1970 1970 +1980 NULL +1990 1990 +1999 1999 +1999 1998 +2000 2020 +2000 2010 +2000 2000 +2001 2001 +2005 NULL +2009 2009 +2020 2040 +2020 2020 +2040 2040 +2060 2060 +2069 2069 +2099 2099 +2100 2100 +2155 2155 +SELECT * FROM t3 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 = '69' ORDER BY c1,c2; +c1 c2 c3 c4 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 = '69' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 = '69' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 = '69' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 <> '69' ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 <> '69' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 > '69' ORDER BY c1,c2; +c1 c2 c3 c4 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 > '69' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 >= '69' ORDER BY c1,c2; +c1 c2 c3 c4 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 >= '69' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +SELECT * FROM t3 WHERE c1 < '69' ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +SELECT * FROM t3 WHERE c1 < '69' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 <= '69' ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 <= '69' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 <=> '69' ORDER BY c1,c2; +c1 c2 c3 c4 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 <=> '69' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 BETWEEN 69 AND '2020' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 BETWEEN 69 AND '2020' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IN (69,'2020') ORDER BY c1,c2; +c1 c2 c3 c4 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 IN (69,'2020') ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +SELECT * FROM t3 WHERE c1 >= 69 AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 >= 69 AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NOT NULL ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 IS NOT NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 <> '69' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 <> '69' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 > '69' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 > '69' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 >= '69' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 >= '69' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +SELECT * FROM t3 WHERE c1 < '69' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +SELECT * FROM t3 WHERE c1 < '69' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 <= '69' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 <= '69' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 <=> '69' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 <=> '69' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 BETWEEN 69 AND '2020' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 BETWEEN 69 AND '2020' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IN (69,'2020') ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 IN (69,'2020') ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t3 WHERE c1 >= 69 AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 >= 69 AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t3; +total_rows min_value max(c2) +21 0 2155 +SELECT * FROM t3 WHERE c3 = '1998-12-11'; +c1 c2 c3 c4 +1990 1990 1998-12-11 1998-12-11 11:30:45 +SELECT c1,c2 FROM t3; +c1 c2 +0000 0000 +1901 1901 +1970 1970 +1980 NULL +1990 1990 +1999 1998 +1999 1999 +2000 2000 +2000 2010 +2000 2020 +2001 2001 +2005 NULL +2009 2009 +2020 2020 +2020 2040 +2040 2040 +2060 2060 +2069 2069 +2099 2099 +2100 2100 +2155 2155 +SELECT c1,c2 FROM t3 ORDER BY c1,c2 DESC; +c1 c2 +0000 0000 +1901 1901 +1970 1970 +1980 NULL +1990 1990 +1999 1999 +1999 1998 +2000 2020 +2000 2010 +2000 2000 +2001 2001 +2005 NULL +2009 2009 +2020 2040 +2020 2020 +2040 2040 +2060 2060 +2069 2069 +2099 2099 +2100 2100 +2155 2155 +SELECT * FROM t3 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c2 = 2000 ORDER BY c1,c2; +c1 c2 c3 c4 +2000 2000 1998-12-29 1998-12-29 11:30:45 +SELECT * FROM t3 WHERE c2 = 2000 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2000 2000 1998-12-29 1998-12-29 11:30:45 +SELECT * FROM t3 WHERE c2 = 2000 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2000 2000 1998-12-29 1998-12-29 11:30:45 +SELECT * FROM t3 WHERE c2 = 2000 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2000 2000 1998-12-29 1998-12-29 11:30:45 +SELECT * FROM t3 WHERE c2 <> 2000 ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 <> 2000 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c2 > 2000 ORDER BY c1,c2; +c1 c2 c3 c4 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 > 2000 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +SELECT * FROM t3 WHERE c2 >= 2000 ORDER BY c1,c2; +c1 c2 c3 c4 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 >= 2000 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +SELECT * FROM t3 WHERE c2 < 2000 ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +SELECT * FROM t3 WHERE c2 < 2000 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c2 <= 2000 ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +SELECT * FROM t3 WHERE c2 <= 2000 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c2 <=> 2000 ORDER BY c1,c2; +c1 c2 c3 c4 +2000 2000 1998-12-29 1998-12-29 11:30:45 +SELECT * FROM t3 WHERE c2 <=> 2000 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2000 2000 1998-12-29 1998-12-29 11:30:45 +SELECT * FROM t3 WHERE c2 BETWEEN '2000' AND 2155 ORDER BY c1,c2; +c1 c2 c3 c4 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 BETWEEN '2000' AND 2155 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +SELECT * FROM t3 WHERE c2 IN ('2000',2155) ORDER BY c1,c2; +c1 c2 c3 c4 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 IN ('2000',2155) ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 >= '2000' AND c2 < 2155 AND c1 = '1999' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 >= '2000' AND c2 < 2155 AND c1 = '1999' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 IS NULL ORDER BY c1,c2; +c1 c2 c3 c4 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +2005 NULL NULL NULL +SELECT * FROM t3 WHERE c2 IS NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +2005 NULL NULL NULL +SELECT * FROM t3 WHERE c2 IS NOT NULL ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 IS NOT NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c2 <> 2000 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 <> 2000 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c2 > 2000 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 > 2000 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +SELECT * FROM t3 WHERE c2 >= 2000 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 >= 2000 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +SELECT * FROM t3 WHERE c2 < 2000 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +SELECT * FROM t3 WHERE c2 < 2000 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c2 <= 2000 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +SELECT * FROM t3 WHERE c2 <= 2000 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c2 <=> 2000 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2000 2000 1998-12-29 1998-12-29 11:30:45 +SELECT * FROM t3 WHERE c2 <=> 2000 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2000 2000 1998-12-29 1998-12-29 11:30:45 +SELECT * FROM t3 WHERE c2 BETWEEN '2000' AND 2155 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 BETWEEN '2000' AND 2155 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +SELECT * FROM t3 WHERE c2 IN ('2000',2155) ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 IN ('2000',2155) ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 >= '2000' AND c2 < 2155 AND c1 = '1999' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 >= '2000' AND c2 < 2155 AND c1 = '1999' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 IS NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +2005 NULL NULL NULL +SELECT * FROM t3 WHERE c2 IS NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +2005 NULL NULL NULL +SELECT * FROM t3 WHERE c2 IS NOT NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t3; +total_rows min_value max(c2) +21 0 2155 +SELECT * FROM t3 WHERE c3 = '1998-12-11'; +c1 c2 c3 c4 +1990 1990 1998-12-11 1998-12-11 11:30:45 +SELECT c1,c2 FROM t3; +c1 c2 +0000 0000 +1901 1901 +1970 1970 +1980 NULL +1990 1990 +1999 1998 +1999 1999 +2000 2000 +2000 2010 +2000 2020 +2001 2001 +2005 NULL +2009 2009 +2020 2020 +2020 2040 +2040 2040 +2060 2060 +2069 2069 +2099 2099 +2100 2100 +2155 2155 +SELECT c1,c2 FROM t3 ORDER BY c1,c2 DESC; +c1 c2 +0000 0000 +1901 1901 +1970 1970 +1980 NULL +1990 1990 +1999 1999 +1999 1998 +2000 2020 +2000 2010 +2000 2000 +2001 2001 +2005 NULL +2009 2009 +2020 2040 +2020 2020 +2040 2040 +2060 2060 +2069 2069 +2099 2099 +2100 2100 +2155 2155 +SELECT * FROM t3 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c2 = NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 = NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 = NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 = NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 <> NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 <> NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 > NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 > NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 >= NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 >= NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 < NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 < NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 <= NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 <= NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 <=> NULL ORDER BY c1,c2; +c1 c2 c3 c4 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +2005 NULL NULL NULL +SELECT * FROM t3 WHERE c2 <=> NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +2005 NULL NULL NULL +SELECT * FROM t3 WHERE c2 BETWEEN NULL AND '2069' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 BETWEEN NULL AND '2069' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 IN (NULL,'2069') ORDER BY c1,c2; +c1 c2 c3 c4 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c2 IN (NULL,'2069') ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c2 >= NULL AND c2 < '2069' AND c1 = '2000' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 >= NULL AND c2 < '2069' AND c1 = '2000' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 IS NULL ORDER BY c1,c2; +c1 c2 c3 c4 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +2005 NULL NULL NULL +SELECT * FROM t3 WHERE c2 IS NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +2005 NULL NULL NULL +SELECT * FROM t3 WHERE c2 IS NOT NULL ORDER BY c1,c2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 IS NOT NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c2 <> NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 <> NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 > NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 > NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 >= NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 >= NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 < NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 < NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 <= NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 <= NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 <=> NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +2005 NULL NULL NULL +SELECT * FROM t3 WHERE c2 <=> NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +2005 NULL NULL NULL +SELECT * FROM t3 WHERE c2 BETWEEN NULL AND '2069' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 BETWEEN NULL AND '2069' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 IN (NULL,'2069') ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c2 IN (NULL,'2069') ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c2 >= NULL AND c2 < '2069' AND c1 = '2000' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 >= NULL AND c2 < '2069' AND c1 = '2000' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 IS NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +2005 NULL NULL NULL +SELECT * FROM t3 WHERE c2 IS NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +2005 NULL NULL NULL +SELECT * FROM t3 WHERE c2 IS NOT NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +1999 1998 1998-12-10 1998-12-10 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +SELECT c1 FROM t3 GROUP BY c1; +c1 +0000 +1901 +1970 +1980 +1990 +1999 +2000 +2001 +2005 +2009 +2020 +2040 +2060 +2069 +2099 +2100 +2155 +SELECT DISTINCT c1 FROM t3; +c1 +0000 +1901 +1970 +1980 +1990 +1999 +2000 +2001 +2005 +2009 +2020 +2040 +2060 +2069 +2099 +2100 +2155 +SELECT c1,MIN(c2) FROM t3 GROUP BY c1; +c1 MIN(c2) +0000 0 +1901 1901 +1970 1970 +1980 NULL +1990 1990 +1999 1998 +2000 2000 +2001 2001 +2005 NULL +2009 2009 +2020 2020 +2040 2040 +2060 2060 +2069 2069 +2099 2099 +2100 2100 +2155 2155 +SELECT * FROM t1 WHERE c1='1901' OR c2='2155'; +c1 c2 c3 c4 +1901 1901 1998-12-31 1998-12-31 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +INSERT INTO t1(c1,c2) VALUES(01,'99'); +ERROR 23000: Duplicate entry '2001' for key 'PRIMARY' +INSERT INTO t2(c1,c2) VALUES(99,99); +ERROR 23000: Duplicate entry '1999-1999' for key 'PRIMARY' +INSERT INTO t1(c1,c2) VALUES('2098',69); +ERROR 23000: Duplicate entry '2069' for key 'c2' +INSERT INTO t3(c1,c2) VALUES(00,00); +ERROR 23000: Duplicate entry '0000-0000' for key 'idx' +INSERT IGNORE INTO t1(c1,c2) VALUES(01,'99'); +Warnings: +Warning 1062 Duplicate entry '2001' for key 'PRIMARY' +INSERT IGNORE INTO t2(c1,c2) VALUES('1999','1999'); +Warnings: +Warning 1062 Duplicate entry '1999-1999' for key 'PRIMARY' +INSERT IGNORE INTO t1(c1,c2) VALUES('2098','69'); +Warnings: +Warning 1062 Duplicate entry '2069' for key 'c2' +INSERT IGNORE INTO t3(c1,c2) VALUES(00,00); +Warnings: +Warning 1062 Duplicate entry '0000-0000' for key 'idx' +SELECT * FROM t1 WHERE c1='01' /* Returns 1 row */; +c1 c2 c3 c4 +2001 2001 1998-12-28 1998-12-28 11:30:45 +SELECT * FROM t2 WHERE c1='1999' AND c2='1999' /* Returns 1 row */; +c1 c2 c3 c4 +1999 1999 1998-12-30 1998-12-30 11:30:45 +SELECT * FROM t1 WHERE c2='69' /* Returns 1 row */; +c1 c2 c3 c4 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1=0 AND c2=0 /* Returns 1 row */; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +SELECT * FROM t1 WHERE c1='02' /* Returns no rows */; +c1 c2 c3 c4 +INSERT INTO t1(c1) VALUES('00') ON DUPLICATE KEY UPDATE c1='02'; +SELECT * FROM t1 WHERE c1='2002' /* Returns 1 row */; +c1 c2 c3 c4 +2002 2000 1998-12-29 1998-12-29 11:30:45 +SELECT * FROM t2 WHERE c1=69 AND c2=70 /* Returns no rows */; +c1 c2 c3 c4 +INSERT INTO t2 VALUES(99,99,'98-12-20','98.12.20 11:30:45') ON DUPLICATE KEY UPDATE c1=69,c2=70; +SELECT * FROM t2 WHERE c1=2069 AND c2=1970 /* Returns 1 row */; +c1 c2 c3 c4 +2069 1970 1998-12-30 1998-12-30 11:30:45 +SELECT * FROM t1 WHERE c1=54 AND c2=53 /* Returns no rows */; +c1 c2 c3 c4 +INSERT INTO t1 VALUES(69,69,'98-12-18','98.12.18 11:30:45') ON DUPLICATE KEY UPDATE c1=54,c2=53; +SELECT * FROM t1 WHERE c1=54 AND c2=53 /* Returns 1 row */; +c1 c2 c3 c4 +2054 2053 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1=6 AND c2=1970 /* Returns no rows */; +c1 c2 c3 c4 +INSERT INTO t3(c1,c2) VALUES('69','69') ON DUPLICATE KEY UPDATE c1=06,c2=70; +SELECT * FROM t3 WHERE c1=2006 AND c2=1970 /* Returns 1 row */; +c1 c2 c3 c4 +2006 1970 1998-12-13 1998-12-13 11:30:45 +CREATE TABLE t5(c1 YEAR NOT NULL, c2 YEAR NULL, c3 DATE, c4 DATETIME, INDEX idx(c1,c2)); +INSERT INTO t5 SELECT * FROM t1; +SELECT * FROM t5; +c1 c2 c3 c4 +0000 0000 2008-01-04 2008-01-05 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1992 NULL NULL NULL +1999 1999 1998-12-30 1998-12-30 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2002 2000 1998-12-29 1998-12-29 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2054 2053 1998-12-13 1998-12-13 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +TRUNCATE TABLE t5; +INSERT INTO t5 SELECT * FROM t2 WHERE c1 >=1970 AND c1 < 1999 AND c2 <> '1990'; +SELECT * FROM t5; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +TRUNCATE TABLE t5; +INSERT INTO t5 SELECT * FROM t3 WHERE c2 BETWEEN '2000' AND '2155'; +SELECT * FROM t5; +c1 c2 c3 c4 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +TRUNCATE TABLE t5; +DROP TABLE t5; +INSERT INTO t1 SET c1='00'; +INSERT IGNORE INTO t2 SET c1=69; +Warnings: +Warning 1364 Field 'c2' doesn't have a default value +INSERT INTO t3 SET c1=70; +INSERT IGNORE INTO t4 SET c2=99; +Warnings: +Warning 1364 Field 'c1' doesn't have a default value +SELECT * FROM t1 WHERE c1=0; +c1 c2 c3 c4 +0000 0000 2008-01-04 2008-01-05 00:00:00 +SELECT * FROM t2 WHERE c1=69; +c1 c2 c3 c4 +2069 0000 NULL NULL +2069 1970 1998-12-30 1998-12-30 11:30:45 +2069 2069 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1=70; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1970 NULL NULL NULL +SELECT * FROM t4 WHERE c2=99; +c1 c2 c3 c4 +0000 1999 NULL NULL +1999 1999 1998-12-02 1998-12-02 11:30:45 +1999 1999 1998-12-10 1998-12-10 11:30:45 +1999 1999 1998-12-23 1998-12-23 11:30:45 +1999 1999 1998-12-30 1998-12-30 11:30:45 +DROP TABLE t1,t2,t3,t4; +CREATE TABLE t1(c1 YEAR(2) NOT NULL, c2 YEAR(2) NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1), UNIQUE INDEX(c2)); +Warnings: +Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +CREATE TABLE t2(c1 YEAR(2) NOT NULL, c2 YEAR(2) NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1,c2)); +Warnings: +Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +CREATE TABLE t3(c1 YEAR(2) NOT NULL, c2 YEAR(2) NULL, c3 DATE, c4 DATETIME, UNIQUE INDEX idx(c1,c2)); +Warnings: +Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +CREATE TABLE t4(c1 YEAR(2) NOT NULL, c2 YEAR(2) NULL, c3 DATE, c4 DATETIME); +Warnings: +Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +INSERT INTO t1 VALUES('1901','1901','98-12-31','98.12.31 11:30:45'),('1999','1999','98-12-30','98.12.30 11:30:45'),('2000','2000','98-12-29','98.12.29 11:30:45'),('2001','2001','98-12-28','98.12.28 11:30:45'),('2099','2099','98-12-27','98.12.27 11:30:45'),('2100','2100','98-12-26','98.12.26 11:30:45'),('2155','2155','98-12-26','98.12.26 11:30:45'); +INSERT INTO t2 VALUES('1901','1901','98-12-31','98.12.31 11:30:45'),('1999','1999','98-12-30','98.12.30 11:30:45'),('2000','2000','98-12-29','98.12.29 11:30:45'),('2001','2001','98-12-28','98.12.28 11:30:45'),('2099','2099','98-12-27','98.12.27 11:30:45'),('2100','2100','98-12-26','98.12.26 11:30:45'),('2155','2155','98-12-26','98.12.26 11:30:45'); +INSERT INTO t3 VALUES('1901','1901','98-12-31','98.12.31 11:30:45'),('1999','1999','98-12-30','98.12.30 11:30:45'),('2000','2000','98-12-29','98.12.29 11:30:45'),('2001','2001','98-12-28','98.12.28 11:30:45'),('2099','2099','98-12-27','98.12.27 11:30:45'),('2100','2100','98-12-26','98.12.26 11:30:45'),('2155','2155','98-12-26','98.12.26 11:30:45'); +INSERT INTO t4 VALUES('1901','1901','98-12-31','98.12.31 11:30:45'),('1999','1999','98-12-30','98.12.30 11:30:45'),('2000','2000','98-12-29','98.12.29 11:30:45'),('2001','2001','98-12-28','98.12.28 11:30:45'),('2099','2099','98-12-27','98.12.27 11:30:45'),('2100','2100','98-12-26','98.12.26 11:30:45'),('2155','2155','98-12-25','98.12.25 11:30:45'); +INSERT INTO t4 VALUES(1901,1901,'98-12-24','98.12.24 11:30:45'),(1999,1999,'98-12-23','98.12.23 11:30:45'),(2000,2000,'98-12-22','98.12.22 11:30:45'),(2001,2001,'98-12-21','98.12.21 11:30:45'),(2099,2099,'98-12-20','98.12.20 11:30:45'),(2100,2100,'98-12-19','98.12.19 11:30:45'),(2155,2155,'98-12-18','98.12.18 11:30:45'); +INSERT INTO t1 VALUES('20','20','98-12-16','98.12.16 11:30:45'),('40','40','98-12-15','98.12.15 11:30:45'),('60','60','98-12-14','98.12.14 11:30:45'),('69','69','98-12-13','98.12.13 11:30:45'),('70','70','98-12-12','98.12.12 11:30:45'),('90','90','98-12-11','98.12.11 11:30:45'); +INSERT INTO t2 VALUES('00','10','98-12-17','98.12.17 11:30:45'),('20','20','98-12-16','98.12.16 11:30:45'),('40','40','98-12-15','98.12.15 11:30:45'),('60','60','98-12-14','98.12.14 11:30:45'),('69','69','98-12-13','98.12.13 11:30:45'),('70','70','98-12-12','98.12.12 11:30:45'),('90','90','98-12-11','98.12.11 11:30:45'),('99','98','98-12-10','98.12.10 11:30:45'); +INSERT INTO t3 VALUES('00','10','98-12-17','98.12.17 11:30:45'),('20','20','98-12-16','98.12.16 11:30:45'),('40','40','98-12-15','98.12.15 11:30:45'),('60','60','98-12-14','98.12.14 11:30:45'),('69','69','98-12-13','98.12.13 11:30:45'),('70','70','98-12-12','98.12.12 11:30:45'),('90','90','98-12-11','98.12.11 11:30:45'),('99','98','98-12-10','98.12.10 11:30:45'); +INSERT INTO t4 VALUES('00','00','98-12-17','98.12.17 11:30:45'),('20','20','98-12-16','98.12.16 11:30:45'),('40','40','98-12-15','98.12.15 11:30:45'),('60','60','98-12-14','98.12.14 11:30:45'),('69','69','98-12-13','98.12.13 11:30:45'),('70','70','98-12-12','98.12.12 11:30:45'),('90','90','98-12-11','98.12.11 11:30:45'),('99','99','98-12-10','98.12.10 11:30:45'); +INSERT INTO t4 VALUES(1,1,'98-12-9','98.12.9 11:30:45'),(20,20,'98-12-8','98.12.8 11:30:45'),(40,40,'98-12-7','98.12.7 11:30:45'),(60,60,'98-12-6','98.12.6 11:30:45'),(69,69,'98-12-5','98.12.5 11:30:45'),(70,70,'98-12-4','98.12.4 11:30:45'),(90,90,'98-12-3','98.12.3 11:30:45'),(99,99,'98-12-2','98.12.2 11:30:45'); +SET TIMESTAMP=1233216687; +INSERT IGNORE INTO t1 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE); +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +Note 1265 Data truncated for column 'c3' at row 1 +INSERT IGNORE INTO t2 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE); +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +Note 1265 Data truncated for column 'c3' at row 1 +INSERT IGNORE INTO t3 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE); +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +Note 1265 Data truncated for column 'c3' at row 1 +INSERT IGNORE INTO t4 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE); +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +Note 1265 Data truncated for column 'c3' at row 1 +INSERT INTO t1(c1) VALUES('5'); +INSERT IGNORE INTO t2(c1) VALUES('5'); +Warnings: +Warning 1364 Field 'c2' doesn't have a default value +INSERT INTO t3(c1) VALUES('5'); +INSERT INTO t4(c1,c2) VALUES('0','000'); +INSERT IGNORE INTO t2 VALUES(1900,2156,'08-01-06','08/01/07'); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +INSERT IGNORE INTO t3 VALUES('1900','2156','08-01-08','08/1/9'); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +INSERT IGNORE INTO t4 VALUES('1900','2156','08-01-08','08/1/9'),(1900,2156,'08-01-08','08/1/9'),(0,00,'08-01-08','08/1/9'),(000,000,'08-01-08','08/1/9'),('-20','100','08-01-08','08/1/9'),(-20,100,'08-01-08','08/1/9'); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +Warning 1264 Out of range value for column 'c1' at row 2 +Warning 1264 Out of range value for column 'c2' at row 2 +Warning 1264 Out of range value for column 'c1' at row 5 +Warning 1264 Out of range value for column 'c2' at row 5 +Warning 1264 Out of range value for column 'c1' at row 6 +Warning 1264 Out of range value for column 'c2' at row 6 +INSERT IGNORE INTO t1 VALUES('','','08-01-04','08/01/05') /* Inserts zero dates for '' strings */; +Warnings: +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1 +INSERT IGNORE INTO t4 VALUES('abcd','abcd','08-01-10','08/01/11'),(1234,1234,'08-01-12','08/01/13') /* Inserts zero dates for absurd dates */; +Warnings: +Warning 1366 Incorrect integer value: 'abcd' for column `test`.`t4`.`c1` at row 1 +Warning 1366 Incorrect integer value: 'abcd' for column `test`.`t4`.`c2` at row 1 +Warning 1264 Out of range value for column 'c1' at row 2 +Warning 1264 Out of range value for column 'c2' at row 2 +INSERT INTO t2 VALUES('20','30','98-12-16','98.12.16 11:30:45'),('40','20','98-12-15','98.12.15 11:30:45'); +INSERT INTO t3 VALUES('00','20','98-12-17','98.12.17 11:30:45'),('20','40','98-12-10','98.12.10 11:30:45'); +INSERT INTO t1 VALUES(80,NULL,'08-01-02','08/01/03'); +INSERT INTO t3 VALUES(80,NULL,'08-01-02','08/01/03'); +INSERT INTO t4 VALUES(80,NULL,'08-01-02','08/01/03'); +INSERT INTO t1(c1,c2) VALUES(1992,NULL); +SELECT * FROM t1; +c1 c2 c3 c4 +00 00 1998-12-26 1998-12-26 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 00 2008-01-04 2008-01-05 00:00:00 +01 01 1998-12-28 1998-12-28 11:30:45 +01 01 1998-12-31 1998-12-31 11:30:45 +05 NULL NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +80 NULL 2008-01-02 2008-01-03 00:00:00 +90 90 1998-12-11 1998-12-11 11:30:45 +92 NULL NULL NULL +99 99 1998-12-27 1998-12-27 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +SELECT * FROM t2; +c1 c2 c3 c4 +00 00 1998-12-26 1998-12-26 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 00 2008-01-06 2008-01-07 00:00:00 +00 10 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +01 01 1998-12-31 1998-12-31 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +SELECT * FROM t3; +c1 c2 c3 c4 +00 00 1998-12-26 1998-12-26 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 00 2008-01-08 2008-01-09 00:00:00 +00 10 1998-12-17 1998-12-17 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +01 01 1998-12-31 1998-12-31 11:30:45 +05 NULL NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +80 NULL 2008-01-02 2008-01-03 00:00:00 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +SELECT * FROM t4; +c1 c2 c3 c4 +00 00 1998-12-17 1998-12-17 11:30:45 +00 00 1998-12-19 1998-12-19 11:30:45 +00 00 1998-12-22 1998-12-22 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 2008-01-10 2008-01-11 00:00:00 +00 00 2008-01-12 2008-01-13 00:00:00 +00 00 NULL NULL +01 01 1998-12-09 1998-12-09 11:30:45 +01 01 1998-12-21 1998-12-21 11:30:45 +01 01 1998-12-24 1998-12-24 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +01 01 1998-12-31 1998-12-31 11:30:45 +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-08 1998-12-08 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-07 1998-12-07 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +55 55 1998-12-18 1998-12-18 11:30:45 +55 55 1998-12-25 1998-12-25 11:30:45 +60 60 1998-12-06 1998-12-06 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-05 1998-12-05 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +70 70 1998-12-04 1998-12-04 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +80 NULL 2008-01-02 2008-01-03 00:00:00 +90 90 1998-12-03 1998-12-03 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-02 1998-12-02 11:30:45 +99 99 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-20 1998-12-20 11:30:45 +99 99 1998-12-23 1998-12-23 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +SELECT * FROM t2; +c1 c2 c3 c4 +00 00 1998-12-26 1998-12-26 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 00 2008-01-06 2008-01-07 00:00:00 +00 10 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +01 01 1998-12-31 1998-12-31 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t2; +total_rows min_value max(c1) +20 0 55 +SELECT * FROM t2 WHERE c3 = '1998-12-11'; +c1 c2 c3 c4 +90 90 1998-12-11 1998-12-11 11:30:45 +SELECT c1,c2 FROM t2; +c1 c2 +00 00 +00 00 +00 00 +00 10 +01 01 +01 01 +05 00 +09 09 +20 20 +20 30 +40 20 +40 40 +55 55 +60 60 +69 69 +70 70 +90 90 +99 98 +99 99 +99 99 +SELECT c1,c2 FROM t2 ORDER BY c1,c2 DESC; +c1 c2 +00 00 +01 01 +70 70 +90 90 +99 99 +99 98 +00 10 +00 00 +01 01 +05 00 +09 09 +20 30 +20 20 +40 40 +40 20 +60 60 +69 69 +99 99 +00 00 +55 55 +SELECT * FROM t2 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 = '1901' ORDER BY c1,c2; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 = '1901' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 = '1901' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 = '1901' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <> '1901' ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 <> '1901' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +70 70 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t2 WHERE c1 > '1901' ORDER BY c1,c2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 > '1901' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +SELECT * FROM t2 WHERE c1 >= '1901' ORDER BY c1,c2; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 >= '1901' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t2 WHERE c1 < '1901' ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +SELECT * FROM t2 WHERE c1 < '1901' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +SELECT * FROM t2 WHERE c1 <= '1901' ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <= '1901' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <=> '1901' ORDER BY c1,c2; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <=> '1901' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 BETWEEN '1901' AND '2020' ORDER BY c1,c2; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 BETWEEN '1901' AND '2020' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +SELECT * FROM t2 WHERE c1 IN ('1901','2020') ORDER BY c1,c2; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 IN ('1901','2020') ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 >= '1901' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2; +c1 c2 c3 c4 +09 09 2009-01-29 2009-01-29 00:00:00 +SELECT * FROM t2 WHERE c1 >= '1901' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +09 09 2009-01-29 2009-01-29 00:00:00 +SELECT * FROM t2 WHERE c1 IS NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 IS NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 IS NOT NULL ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 IS NOT NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <> '1901' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 30 1998-12-16 1998-12-16 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 <> '1901' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +70 70 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t2 WHERE c1 > '1901' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 30 1998-12-16 1998-12-16 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 > '1901' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +SELECT * FROM t2 WHERE c1 >= '1901' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 30 1998-12-16 1998-12-16 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 >= '1901' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t2 WHERE c1 < '1901' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +SELECT * FROM t2 WHERE c1 < '1901' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +SELECT * FROM t2 WHERE c1 <= '1901' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <= '1901' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <=> '1901' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <=> '1901' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 BETWEEN '1901' AND '2020' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 30 1998-12-16 1998-12-16 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 BETWEEN '1901' AND '2020' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +SELECT * FROM t2 WHERE c1 IN ('1901','2020') ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 IN ('1901','2020') ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 >= '1901' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +09 09 2009-01-29 2009-01-29 00:00:00 +SELECT * FROM t2 WHERE c1 >= '1901' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +09 09 2009-01-29 2009-01-29 00:00:00 +SELECT * FROM t2 WHERE c1 IS NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 IS NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 30 1998-12-16 1998-12-16 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2; +c1 c2 c3 c4 +00 00 1998-12-26 1998-12-26 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 00 2008-01-06 2008-01-07 00:00:00 +00 10 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +01 01 1998-12-31 1998-12-31 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t2; +total_rows min_value max(c1) +20 0 55 +SELECT * FROM t2 WHERE c3 = '1998-12-11'; +c1 c2 c3 c4 +90 90 1998-12-11 1998-12-11 11:30:45 +SELECT c1,c2 FROM t2; +c1 c2 +00 00 +00 00 +00 00 +00 10 +01 01 +01 01 +05 00 +09 09 +20 20 +20 30 +40 20 +40 40 +55 55 +60 60 +69 69 +70 70 +90 90 +99 98 +99 99 +99 99 +SELECT c1,c2 FROM t2 ORDER BY c1,c2 DESC; +c1 c2 +00 00 +01 01 +70 70 +90 90 +99 99 +99 98 +00 10 +00 00 +01 01 +05 00 +09 09 +20 30 +20 20 +40 40 +40 20 +60 60 +69 69 +99 99 +00 00 +55 55 +SELECT * FROM t2 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 = '10' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 = '10' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 = '10' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 = '10' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 <> '10' ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 <> '10' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 > '10' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 >= '10' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 < '10' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <= '10' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <=> '10' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 <=> '10' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 BETWEEN '10' AND '2020' ORDER BY c1,c2; +c1 c2 c3 c4 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 BETWEEN '10' AND '2020' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 IN ('10','2020') ORDER BY c1,c2; +c1 c2 c3 c4 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 IN ('10','2020') ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 >= '10' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 >= '10' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 IS NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 IS NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 IS NOT NULL ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 IS NOT NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <> '10' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 30 1998-12-16 1998-12-16 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 <> '10' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 > '10' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +20 30 1998-12-16 1998-12-16 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 >= '10' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +20 30 1998-12-16 1998-12-16 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 < '10' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <= '10' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c1 <=> '10' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 <=> '10' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 BETWEEN '10' AND '2020' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +20 30 1998-12-16 1998-12-16 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 BETWEEN '10' AND '2020' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +20 30 1998-12-16 1998-12-16 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 IN ('10','2020') ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +20 30 1998-12-16 1998-12-16 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 IN ('10','2020') ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +20 30 1998-12-16 1998-12-16 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t2 WHERE c1 >= '10' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 >= '10' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 IS NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 IS NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 30 1998-12-16 1998-12-16 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2; +c1 c2 c3 c4 +00 00 1998-12-26 1998-12-26 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 00 2008-01-06 2008-01-07 00:00:00 +00 10 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +01 01 1998-12-31 1998-12-31 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t2; +total_rows min_value max(c2) +20 70 69 +SELECT * FROM t2 WHERE c3 = '1998-12-11'; +c1 c2 c3 c4 +90 90 1998-12-11 1998-12-11 11:30:45 +SELECT c1,c2 FROM t2; +c1 c2 +00 00 +00 00 +00 00 +00 10 +01 01 +01 01 +05 00 +09 09 +20 20 +20 30 +40 20 +40 40 +55 55 +60 60 +69 69 +70 70 +90 90 +99 98 +99 99 +99 99 +SELECT c1,c2 FROM t2 ORDER BY c1,c2 DESC; +c1 c2 +00 00 +01 01 +70 70 +90 90 +99 99 +99 98 +00 10 +00 00 +01 01 +05 00 +09 09 +20 30 +20 20 +40 40 +40 20 +60 60 +69 69 +99 99 +00 00 +55 55 +SELECT * FROM t2 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c2 = 2155 ORDER BY c1,c2; +c1 c2 c3 c4 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 = 2155 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 = 2155 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 = 2155 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 <> 2155 ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 <> 2155 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c2 > 2155 ORDER BY c1,c2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +SELECT * FROM t2 WHERE c2 > 2155 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +SELECT * FROM t2 WHERE c2 >= 2155 ORDER BY c1,c2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 >= 2155 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +SELECT * FROM t2 WHERE c2 < 2155 ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 < 2155 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c2 <= 2155 ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 <= 2155 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c2 <=> 2155 ORDER BY c1,c2; +c1 c2 c3 c4 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 <=> 2155 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 BETWEEN '1970' AND 2155 ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 BETWEEN '1970' AND 2155 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IN ('1970',2155) ORDER BY c1,c2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 IN ('1970',2155) ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 >= '1970' AND c2 < 2155 AND c1 = '1999' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 >= '1970' AND c2 < 2155 AND c1 = '1999' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NOT NULL ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 IS NOT NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c2 <> 2155 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 30 1998-12-16 1998-12-16 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 <> 2155 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c2 > 2155 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +SELECT * FROM t2 WHERE c2 > 2155 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +SELECT * FROM t2 WHERE c2 >= 2155 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 >= 2155 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +SELECT * FROM t2 WHERE c2 < 2155 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 30 1998-12-16 1998-12-16 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 < 2155 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c2 <= 2155 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 30 1998-12-16 1998-12-16 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 <= 2155 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c2 <=> 2155 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 <=> 2155 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 BETWEEN '1970' AND 2155 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 BETWEEN '1970' AND 2155 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IN ('1970',2155) ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 IN ('1970',2155) ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 >= '1970' AND c2 < 2155 AND c1 = '1999' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 >= '1970' AND c2 < 2155 AND c1 = '1999' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NOT NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 30 1998-12-16 1998-12-16 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2; +c1 c2 c3 c4 +00 00 1998-12-26 1998-12-26 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 00 2008-01-06 2008-01-07 00:00:00 +00 10 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +01 01 1998-12-31 1998-12-31 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t2; +total_rows min_value max(c2) +20 70 69 +SELECT * FROM t2 WHERE c3 = '1998-12-11'; +c1 c2 c3 c4 +90 90 1998-12-11 1998-12-11 11:30:45 +SELECT c1,c2 FROM t2; +c1 c2 +00 00 +00 00 +00 00 +00 10 +01 01 +01 01 +05 00 +09 09 +20 20 +20 30 +40 20 +40 40 +55 55 +60 60 +69 69 +70 70 +90 90 +99 98 +99 99 +99 99 +SELECT c1,c2 FROM t2 ORDER BY c1,c2 DESC; +c1 c2 +00 00 +01 01 +70 70 +90 90 +99 99 +99 98 +00 10 +00 00 +01 01 +05 00 +09 09 +20 30 +20 20 +40 40 +40 20 +60 60 +69 69 +99 99 +00 00 +55 55 +SELECT * FROM t2 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c2 = NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 = NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 = NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 = NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <> NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <> NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 > NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 > NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 >= NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 >= NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 < NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 < NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <= NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <= NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <=> NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <=> NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 BETWEEN NULL AND '2069' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 BETWEEN NULL AND '2069' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IN (NULL,'2069') ORDER BY c1,c2; +c1 c2 c3 c4 +69 69 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t2 WHERE c2 IN (NULL,'2069') ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +69 69 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t2 WHERE c2 >= NULL AND c2 < '2069' AND c1 = '2000' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 >= NULL AND c2 < '2069' AND c1 = '2000' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NOT NULL ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 30 1998-12-16 1998-12-16 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 IS NOT NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t2 WHERE c2 <> NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <> NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 > NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 > NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 >= NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 >= NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 < NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 < NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <= NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <= NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <=> NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 <=> NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 BETWEEN NULL AND '2069' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 BETWEEN NULL AND '2069' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IN (NULL,'2069') ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +69 69 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t2 WHERE c2 IN (NULL,'2069') ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +69 69 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t2 WHERE c2 >= NULL AND c2 < '2069' AND c1 = '2000' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 >= NULL AND c2 < '2069' AND c1 = '2000' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t2 WHERE c2 IS NOT NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 00 NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 30 1998-12-16 1998-12-16 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +40 20 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t2 WHERE c2 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-06 2008-01-07 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3; +c1 c2 c3 c4 +00 00 1998-12-26 1998-12-26 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 00 2008-01-08 2008-01-09 00:00:00 +00 10 1998-12-17 1998-12-17 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +01 01 1998-12-31 1998-12-31 11:30:45 +05 NULL NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +80 NULL 2008-01-02 2008-01-03 00:00:00 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t3; +total_rows min_value max(c1) +21 0 55 +SELECT * FROM t3 WHERE c3 = '1998-12-11'; +c1 c2 c3 c4 +90 90 1998-12-11 1998-12-11 11:30:45 +SELECT c1,c2 FROM t3; +c1 c2 +00 00 +00 00 +00 00 +00 10 +00 20 +01 01 +01 01 +05 NULL +09 09 +20 20 +20 40 +40 40 +55 55 +60 60 +69 69 +70 70 +80 NULL +90 90 +99 98 +99 99 +99 99 +SELECT c1,c2 FROM t3 ORDER BY c1,c2 DESC; +c1 c2 +00 00 +01 01 +70 70 +80 NULL +90 90 +99 99 +99 98 +00 20 +00 10 +00 00 +01 01 +05 NULL +09 09 +20 40 +20 20 +40 40 +60 60 +69 69 +99 99 +00 00 +55 55 +SELECT * FROM t3 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 = '1970' ORDER BY c1,c2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c1 = '1970' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c1 = '1970' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c1 = '1970' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c1 <> '1970' ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +80 NULL 2008-01-02 2008-01-03 00:00:00 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 NULL NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 <> '1970' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 > '1970' ORDER BY c1,c2; +c1 c2 c3 c4 +80 NULL 2008-01-02 2008-01-03 00:00:00 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +SELECT * FROM t3 WHERE c1 > '1970' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +80 NULL 2008-01-02 2008-01-03 00:00:00 +90 90 1998-12-11 1998-12-11 11:30:45 +SELECT * FROM t3 WHERE c1 >= '1970' ORDER BY c1,c2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +80 NULL 2008-01-02 2008-01-03 00:00:00 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +SELECT * FROM t3 WHERE c1 >= '1970' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +80 NULL 2008-01-02 2008-01-03 00:00:00 +SELECT * FROM t3 WHERE c1 < '1970' ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 < '1970' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 <= '1970' ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c1 <= '1970' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 <=> '1970' ORDER BY c1,c2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c1 <=> '1970' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c1 BETWEEN '1970' AND '2020' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 BETWEEN '1970' AND '2020' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IN ('1970','2020') ORDER BY c1,c2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +SELECT * FROM t3 WHERE c1 IN ('1970','2020') ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t3 WHERE c1 >= '1970' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 >= '1970' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NOT NULL ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +80 NULL 2008-01-02 2008-01-03 00:00:00 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 NULL NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 IS NOT NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 <> '1970' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +80 NULL 2008-01-02 2008-01-03 00:00:00 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 NULL NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 40 1998-12-10 1998-12-10 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 <> '1970' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 > '1970' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +80 NULL 2008-01-02 2008-01-03 00:00:00 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +SELECT * FROM t3 WHERE c1 > '1970' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +80 NULL 2008-01-02 2008-01-03 00:00:00 +90 90 1998-12-11 1998-12-11 11:30:45 +SELECT * FROM t3 WHERE c1 >= '1970' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +80 NULL 2008-01-02 2008-01-03 00:00:00 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +SELECT * FROM t3 WHERE c1 >= '1970' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +80 NULL 2008-01-02 2008-01-03 00:00:00 +SELECT * FROM t3 WHERE c1 < '1970' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 < '1970' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 <= '1970' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c1 <= '1970' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 <=> '1970' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c1 <=> '1970' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c1 BETWEEN '1970' AND '2020' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 BETWEEN '1970' AND '2020' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IN ('1970','2020') ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t3 WHERE c1 IN ('1970','2020') ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +SELECT * FROM t3 WHERE c1 >= '1970' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 >= '1970' AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +80 NULL 2008-01-02 2008-01-03 00:00:00 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 NULL NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 40 1998-12-10 1998-12-10 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3; +c1 c2 c3 c4 +00 00 1998-12-26 1998-12-26 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 00 2008-01-08 2008-01-09 00:00:00 +00 10 1998-12-17 1998-12-17 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +01 01 1998-12-31 1998-12-31 11:30:45 +05 NULL NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +80 NULL 2008-01-02 2008-01-03 00:00:00 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t3; +total_rows min_value max(c1) +21 0 55 +SELECT * FROM t3 WHERE c3 = '1998-12-11'; +c1 c2 c3 c4 +90 90 1998-12-11 1998-12-11 11:30:45 +SELECT c1,c2 FROM t3; +c1 c2 +00 00 +00 00 +00 00 +00 10 +00 20 +01 01 +01 01 +05 NULL +09 09 +20 20 +20 40 +40 40 +55 55 +60 60 +69 69 +70 70 +80 NULL +90 90 +99 98 +99 99 +99 99 +SELECT c1,c2 FROM t3 ORDER BY c1,c2 DESC; +c1 c2 +00 00 +01 01 +70 70 +80 NULL +90 90 +99 99 +99 98 +00 20 +00 10 +00 00 +01 01 +05 NULL +09 09 +20 40 +20 20 +40 40 +60 60 +69 69 +99 99 +00 00 +55 55 +SELECT * FROM t3 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 = '69' ORDER BY c1,c2; +c1 c2 c3 c4 +69 69 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 = '69' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +69 69 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 = '69' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +69 69 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 = '69' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +69 69 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 <> '69' ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +80 NULL 2008-01-02 2008-01-03 00:00:00 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 NULL NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 <> '69' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 > '69' ORDER BY c1,c2; +c1 c2 c3 c4 +99 99 1998-12-27 1998-12-27 11:30:45 +SELECT * FROM t3 WHERE c1 > '69' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +99 99 1998-12-27 1998-12-27 11:30:45 +SELECT * FROM t3 WHERE c1 >= '69' ORDER BY c1,c2; +c1 c2 c3 c4 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +SELECT * FROM t3 WHERE c1 >= '69' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +SELECT * FROM t3 WHERE c1 < '69' ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 NULL NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 < '69' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 <= '69' ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 NULL NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 <= '69' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 <=> '69' ORDER BY c1,c2; +c1 c2 c3 c4 +69 69 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 <=> '69' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +69 69 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 BETWEEN 69 AND '2020' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 BETWEEN 69 AND '2020' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IN (69,'2020') ORDER BY c1,c2; +c1 c2 c3 c4 +20 20 1998-12-16 1998-12-16 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 IN (69,'2020') ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +20 20 1998-12-16 1998-12-16 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +SELECT * FROM t3 WHERE c1 >= 69 AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 >= 69 AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NOT NULL ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +80 NULL 2008-01-02 2008-01-03 00:00:00 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 NULL NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 IS NOT NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 <> '69' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +80 NULL 2008-01-02 2008-01-03 00:00:00 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 NULL NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 40 1998-12-10 1998-12-10 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 <> '69' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 > '69' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +99 99 1998-12-27 1998-12-27 11:30:45 +SELECT * FROM t3 WHERE c1 > '69' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +99 99 1998-12-27 1998-12-27 11:30:45 +SELECT * FROM t3 WHERE c1 >= '69' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +SELECT * FROM t3 WHERE c1 >= '69' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +SELECT * FROM t3 WHERE c1 < '69' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 NULL NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 40 1998-12-10 1998-12-10 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 < '69' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 <= '69' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 NULL NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 40 1998-12-10 1998-12-10 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 <= '69' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c1 <=> '69' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +69 69 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 <=> '69' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +69 69 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 BETWEEN 69 AND '2020' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 BETWEEN 69 AND '2020' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IN (69,'2020') ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +20 40 1998-12-10 1998-12-10 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1 IN (69,'2020') ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +20 40 1998-12-10 1998-12-10 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +SELECT * FROM t3 WHERE c1 >= 69 AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 >= 69 AND c1 < '2020' AND c2 = '2009' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +80 NULL 2008-01-02 2008-01-03 00:00:00 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +05 NULL NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 40 1998-12-10 1998-12-10 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3; +c1 c2 c3 c4 +00 00 1998-12-26 1998-12-26 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 00 2008-01-08 2008-01-09 00:00:00 +00 10 1998-12-17 1998-12-17 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +01 01 1998-12-31 1998-12-31 11:30:45 +05 NULL NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +80 NULL 2008-01-02 2008-01-03 00:00:00 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t3; +total_rows min_value max(c2) +21 70 69 +SELECT * FROM t3 WHERE c3 = '1998-12-11'; +c1 c2 c3 c4 +90 90 1998-12-11 1998-12-11 11:30:45 +SELECT c1,c2 FROM t3; +c1 c2 +00 00 +00 00 +00 00 +00 10 +00 20 +01 01 +01 01 +05 NULL +09 09 +20 20 +20 40 +40 40 +55 55 +60 60 +69 69 +70 70 +80 NULL +90 90 +99 98 +99 99 +99 99 +SELECT c1,c2 FROM t3 ORDER BY c1,c2 DESC; +c1 c2 +00 00 +01 01 +70 70 +80 NULL +90 90 +99 99 +99 98 +00 20 +00 10 +00 00 +01 01 +05 NULL +09 09 +20 40 +20 20 +40 40 +60 60 +69 69 +99 99 +00 00 +55 55 +SELECT * FROM t3 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c2 = 2000 ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 1998-12-29 1998-12-29 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 = 2000 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 1998-12-29 1998-12-29 11:30:45 +SELECT * FROM t3 WHERE c2 = 2000 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 1998-12-29 1998-12-29 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 = 2000 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 1998-12-29 1998-12-29 11:30:45 +SELECT * FROM t3 WHERE c2 <> 2000 ORDER BY c1,c2; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 <> 2000 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c2 > 2000 ORDER BY c1,c2; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 > 2000 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c2 >= 2000 ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 >= 2000 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c2 < 2000 ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 < 2000 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 <= 2000 ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 1998-12-29 1998-12-29 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 <= 2000 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 1998-12-29 1998-12-29 11:30:45 +SELECT * FROM t3 WHERE c2 <=> 2000 ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 1998-12-29 1998-12-29 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 <=> 2000 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 1998-12-29 1998-12-29 11:30:45 +SELECT * FROM t3 WHERE c2 BETWEEN '2000' AND 2155 ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 BETWEEN '2000' AND 2155 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c2 IN ('2000',2155) ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 1998-12-29 1998-12-29 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 IN ('2000',2155) ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 1998-12-29 1998-12-29 11:30:45 +SELECT * FROM t3 WHERE c2 >= '2000' AND c2 < 2155 AND c1 = '1999' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 >= '2000' AND c2 < 2155 AND c1 = '1999' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 IS NULL ORDER BY c1,c2; +c1 c2 c3 c4 +80 NULL 2008-01-02 2008-01-03 00:00:00 +05 NULL NULL NULL +SELECT * FROM t3 WHERE c2 IS NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +80 NULL 2008-01-02 2008-01-03 00:00:00 +05 NULL NULL NULL +SELECT * FROM t3 WHERE c2 IS NOT NULL ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 IS NOT NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c2 <> 2000 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +09 09 2009-01-29 2009-01-29 00:00:00 +20 40 1998-12-10 1998-12-10 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 <> 2000 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c2 > 2000 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +09 09 2009-01-29 2009-01-29 00:00:00 +20 40 1998-12-10 1998-12-10 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 > 2000 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +SELECT * FROM t3 WHERE c2 >= 2000 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +09 09 2009-01-29 2009-01-29 00:00:00 +20 40 1998-12-10 1998-12-10 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 >= 2000 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c2 < 2000 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 < 2000 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 <= 2000 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 1998-12-29 1998-12-29 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 <= 2000 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 1998-12-29 1998-12-29 11:30:45 +SELECT * FROM t3 WHERE c2 <=> 2000 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 1998-12-29 1998-12-29 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 <=> 2000 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 1998-12-29 1998-12-29 11:30:45 +SELECT * FROM t3 WHERE c2 BETWEEN '2000' AND 2155 ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +09 09 2009-01-29 2009-01-29 00:00:00 +20 40 1998-12-10 1998-12-10 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 BETWEEN '2000' AND 2155 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c2 IN ('2000',2155) ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 1998-12-29 1998-12-29 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 IN ('2000',2155) ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +00 00 1998-12-29 1998-12-29 11:30:45 +SELECT * FROM t3 WHERE c2 >= '2000' AND c2 < 2155 AND c1 = '1999' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 >= '2000' AND c2 < 2155 AND c1 = '1999' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 IS NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +80 NULL 2008-01-02 2008-01-03 00:00:00 +05 NULL NULL NULL +SELECT * FROM t3 WHERE c2 IS NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +80 NULL 2008-01-02 2008-01-03 00:00:00 +05 NULL NULL NULL +SELECT * FROM t3 WHERE c2 IS NOT NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +09 09 2009-01-29 2009-01-29 00:00:00 +20 40 1998-12-10 1998-12-10 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3; +c1 c2 c3 c4 +00 00 1998-12-26 1998-12-26 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 00 2008-01-08 2008-01-09 00:00:00 +00 10 1998-12-17 1998-12-17 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +01 01 1998-12-31 1998-12-31 11:30:45 +05 NULL NULL NULL +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +80 NULL 2008-01-02 2008-01-03 00:00:00 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t3; +total_rows min_value max(c2) +21 70 69 +SELECT * FROM t3 WHERE c3 = '1998-12-11'; +c1 c2 c3 c4 +90 90 1998-12-11 1998-12-11 11:30:45 +SELECT c1,c2 FROM t3; +c1 c2 +00 00 +00 00 +00 00 +00 10 +00 20 +01 01 +01 01 +05 NULL +09 09 +20 20 +20 40 +40 40 +55 55 +60 60 +69 69 +70 70 +80 NULL +90 90 +99 98 +99 99 +99 99 +SELECT c1,c2 FROM t3 ORDER BY c1,c2 DESC; +c1 c2 +00 00 +01 01 +70 70 +80 NULL +90 90 +99 99 +99 98 +00 20 +00 10 +00 00 +01 01 +05 NULL +09 09 +20 40 +20 20 +40 40 +60 60 +69 69 +99 99 +00 00 +55 55 +SELECT * FROM t3 ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c2 = NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 = NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 = NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 = NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 <> NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 <> NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 > NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 > NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 >= NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 >= NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 < NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 < NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 <= NULL ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 <= NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 <=> NULL ORDER BY c1,c2; +c1 c2 c3 c4 +80 NULL 2008-01-02 2008-01-03 00:00:00 +05 NULL NULL NULL +SELECT * FROM t3 WHERE c2 <=> NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +80 NULL 2008-01-02 2008-01-03 00:00:00 +05 NULL NULL NULL +SELECT * FROM t3 WHERE c2 BETWEEN NULL AND '2069' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 BETWEEN NULL AND '2069' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 IN (NULL,'2069') ORDER BY c1,c2; +c1 c2 c3 c4 +69 69 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c2 IN (NULL,'2069') ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +69 69 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c2 >= NULL AND c2 < '2069' AND c1 = '2000' ORDER BY c1,c2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 >= NULL AND c2 < '2069' AND c1 = '2000' ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 IS NULL ORDER BY c1,c2; +c1 c2 c3 c4 +80 NULL 2008-01-02 2008-01-03 00:00:00 +05 NULL NULL NULL +SELECT * FROM t3 WHERE c2 IS NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +80 NULL 2008-01-02 2008-01-03 00:00:00 +05 NULL NULL NULL +SELECT * FROM t3 WHERE c2 IS NOT NULL ORDER BY c1,c2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +09 09 2009-01-29 2009-01-29 00:00:00 +20 20 1998-12-16 1998-12-16 11:30:45 +20 40 1998-12-10 1998-12-10 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 IS NOT NULL ORDER BY c1,c2 LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT * FROM t3 WHERE c2 <> NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 <> NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 > NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 > NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 >= NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 >= NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 < NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 < NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 <= NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 <= NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 <=> NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +80 NULL 2008-01-02 2008-01-03 00:00:00 +05 NULL NULL NULL +SELECT * FROM t3 WHERE c2 <=> NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +80 NULL 2008-01-02 2008-01-03 00:00:00 +05 NULL NULL NULL +SELECT * FROM t3 WHERE c2 BETWEEN NULL AND '2069' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 BETWEEN NULL AND '2069' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 IN (NULL,'2069') ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +69 69 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c2 IN (NULL,'2069') ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +69 69 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c2 >= NULL AND c2 < '2069' AND c1 = '2000' ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 >= NULL AND c2 < '2069' AND c1 = '2000' ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +SELECT * FROM t3 WHERE c2 IS NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +80 NULL 2008-01-02 2008-01-03 00:00:00 +05 NULL NULL NULL +SELECT * FROM t3 WHERE c2 IS NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +80 NULL 2008-01-02 2008-01-03 00:00:00 +05 NULL NULL NULL +SELECT * FROM t3 WHERE c2 IS NOT NULL ORDER BY c1,c2 DESC; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +70 70 1998-12-12 1998-12-12 11:30:45 +90 90 1998-12-11 1998-12-11 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +99 98 1998-12-10 1998-12-10 11:30:45 +00 20 1998-12-17 1998-12-17 11:30:45 +00 10 1998-12-17 1998-12-17 11:30:45 +00 00 1998-12-29 1998-12-29 11:30:45 +01 01 1998-12-28 1998-12-28 11:30:45 +09 09 2009-01-29 2009-01-29 00:00:00 +20 40 1998-12-10 1998-12-10 11:30:45 +20 20 1998-12-16 1998-12-16 11:30:45 +40 40 1998-12-15 1998-12-15 11:30:45 +60 60 1998-12-14 1998-12-14 11:30:45 +69 69 1998-12-13 1998-12-13 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +00 00 1998-12-26 1998-12-26 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +SELECT * FROM t3 WHERE c2 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; +c1 c2 c3 c4 +00 00 2008-01-08 2008-01-09 00:00:00 +01 01 1998-12-31 1998-12-31 11:30:45 +SELECT c1 FROM t3 GROUP BY c1; +c1 +00 +00 +00 +01 +01 +05 +09 +20 +40 +55 +60 +69 +70 +80 +90 +99 +99 +SELECT DISTINCT c1 FROM t3; +c1 +00 +00 +00 +01 +01 +05 +09 +20 +40 +55 +60 +69 +70 +80 +90 +99 +99 +SELECT c1,MIN(c2) FROM t3 GROUP BY c1; +c1 MIN(c2) +00 0 +00 0 +00 0 +01 1 +01 1 +05 NULL +09 9 +20 20 +40 40 +55 55 +60 60 +69 69 +70 70 +80 NULL +90 90 +99 98 +99 99 +SELECT * FROM t1 WHERE c1='1901' OR c2='2155'; +c1 c2 c3 c4 +01 01 1998-12-31 1998-12-31 11:30:45 +55 55 1998-12-26 1998-12-26 11:30:45 +INSERT INTO t1(c1,c2) VALUES(01,'99'); +ERROR 23000: Duplicate entry '01' for key 'PRIMARY' +INSERT INTO t2(c1,c2) VALUES(99,99); +ERROR 23000: Duplicate entry '99-99' for key 'PRIMARY' +INSERT INTO t1(c1,c2) VALUES('2098',69); +ERROR 23000: Duplicate entry '69' for key 'c2' +INSERT INTO t3(c1,c2) VALUES(00,00); +ERROR 23000: Duplicate entry '00-00' for key 'idx' +INSERT IGNORE INTO t1(c1,c2) VALUES(01,'99'); +Warnings: +Warning 1062 Duplicate entry '01' for key 'PRIMARY' +INSERT IGNORE INTO t2(c1,c2) VALUES('1999','1999'); +Warnings: +Warning 1062 Duplicate entry '99-99' for key 'PRIMARY' +INSERT IGNORE INTO t1(c1,c2) VALUES('2098','69'); +Warnings: +Warning 1062 Duplicate entry '69' for key 'c2' +INSERT IGNORE INTO t3(c1,c2) VALUES(00,00); +Warnings: +Warning 1062 Duplicate entry '00-00' for key 'idx' +SELECT * FROM t1 WHERE c1='01' /* Returns 1 row */; +c1 c2 c3 c4 +01 01 1998-12-28 1998-12-28 11:30:45 +SELECT * FROM t2 WHERE c1='1999' AND c2='1999' /* Returns 1 row */; +c1 c2 c3 c4 +99 99 1998-12-30 1998-12-30 11:30:45 +SELECT * FROM t1 WHERE c2='69' /* Returns 1 row */; +c1 c2 c3 c4 +69 69 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1=0 AND c2=0 /* Returns 1 row */; +c1 c2 c3 c4 +00 00 1998-12-29 1998-12-29 11:30:45 +SELECT * FROM t1 WHERE c1='02' /* Returns no rows */; +c1 c2 c3 c4 +INSERT INTO t1(c1) VALUES('00') ON DUPLICATE KEY UPDATE c1='02'; +SELECT * FROM t1 WHERE c1='2002' /* Returns 1 row */; +c1 c2 c3 c4 +02 00 1998-12-29 1998-12-29 11:30:45 +SELECT * FROM t2 WHERE c1=69 AND c2=70 /* Returns no rows */; +c1 c2 c3 c4 +INSERT INTO t2 VALUES(99,99,'98-12-20','98.12.20 11:30:45') ON DUPLICATE KEY UPDATE c1=69,c2=70; +SELECT * FROM t2 WHERE c1=2069 AND c2=1970 /* Returns 1 row */; +c1 c2 c3 c4 +69 70 1998-12-30 1998-12-30 11:30:45 +SELECT * FROM t1 WHERE c1=54 AND c2=53 /* Returns no rows */; +c1 c2 c3 c4 +INSERT INTO t1 VALUES(69,69,'98-12-18','98.12.18 11:30:45') ON DUPLICATE KEY UPDATE c1=54,c2=53; +SELECT * FROM t1 WHERE c1=54 AND c2=53 /* Returns 1 row */; +c1 c2 c3 c4 +54 53 1998-12-13 1998-12-13 11:30:45 +SELECT * FROM t3 WHERE c1=6 AND c2=1970 /* Returns no rows */; +c1 c2 c3 c4 +INSERT INTO t3(c1,c2) VALUES('69','69') ON DUPLICATE KEY UPDATE c1=06,c2=70; +SELECT * FROM t3 WHERE c1=2006 AND c2=1970 /* Returns 1 row */; +c1 c2 c3 c4 +06 70 1998-12-13 1998-12-13 11:30:45 +CREATE TABLE t5(c1 YEAR NOT NULL, c2 YEAR NULL, c3 DATE, c4 DATETIME, INDEX idx(c1,c2)); +INSERT INTO t5 SELECT * FROM t1; +SELECT * FROM t5; +c1 c2 c3 c4 +0000 0000 2008-01-04 2008-01-05 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +1970 1970 1998-12-12 1998-12-12 11:30:45 +1980 NULL 2008-01-02 2008-01-03 00:00:00 +1990 1990 1998-12-11 1998-12-11 11:30:45 +1992 NULL NULL NULL +1999 1999 1998-12-30 1998-12-30 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2002 2000 1998-12-29 1998-12-29 11:30:45 +2005 NULL NULL NULL +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2054 2053 1998-12-13 1998-12-13 11:30:45 +2060 2060 1998-12-14 1998-12-14 11:30:45 +2099 2099 1998-12-27 1998-12-27 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +TRUNCATE TABLE t5; +INSERT INTO t5 SELECT * FROM t2 WHERE c1 >=1970 AND c1 < 1999 AND c2 <> '1990'; +SELECT * FROM t5; +c1 c2 c3 c4 +1970 1970 1998-12-12 1998-12-12 11:30:45 +TRUNCATE TABLE t5; +INSERT INTO t5 SELECT * FROM t3 WHERE c2 BETWEEN '2000' AND '2155'; +SELECT * FROM t5; +c1 c2 c3 c4 +0000 0000 2008-01-08 2008-01-09 00:00:00 +1901 1901 1998-12-31 1998-12-31 11:30:45 +2000 2000 1998-12-29 1998-12-29 11:30:45 +2000 2010 1998-12-17 1998-12-17 11:30:45 +2000 2020 1998-12-17 1998-12-17 11:30:45 +2001 2001 1998-12-28 1998-12-28 11:30:45 +2009 2009 2009-01-29 2009-01-29 00:00:00 +2020 2020 1998-12-16 1998-12-16 11:30:45 +2020 2040 1998-12-10 1998-12-10 11:30:45 +2040 2040 1998-12-15 1998-12-15 11:30:45 +2100 2100 1998-12-26 1998-12-26 11:30:45 +2155 2155 1998-12-26 1998-12-26 11:30:45 +TRUNCATE TABLE t5; +DROP TABLE t5; +INSERT INTO t1 SET c1='00'; +INSERT IGNORE INTO t2 SET c1=69; +Warnings: +Warning 1364 Field 'c2' doesn't have a default value +INSERT INTO t3 SET c1=70; +INSERT IGNORE INTO t4 SET c2=99; +Warnings: +Warning 1364 Field 'c1' doesn't have a default value +SELECT * FROM t1 WHERE c1=0; +c1 c2 c3 c4 +00 NULL NULL NULL +SELECT * FROM t2 WHERE c1=69; +c1 c2 c3 c4 +69 00 NULL NULL +69 69 1998-12-13 1998-12-13 11:30:45 +69 70 1998-12-30 1998-12-30 11:30:45 +SELECT * FROM t3 WHERE c1=70; +c1 c2 c3 c4 +70 70 1998-12-12 1998-12-12 11:30:45 +70 NULL NULL NULL +SELECT * FROM t4 WHERE c2=99; +c1 c2 c3 c4 +00 99 NULL NULL +99 99 1998-12-02 1998-12-02 11:30:45 +99 99 1998-12-10 1998-12-10 11:30:45 +99 99 1998-12-20 1998-12-20 11:30:45 +99 99 1998-12-23 1998-12-23 11:30:45 +99 99 1998-12-27 1998-12-27 11:30:45 +99 99 1998-12-30 1998-12-30 11:30:45 +DROP TABLE t1,t2,t3,t4; |