summaryrefslogtreecommitdiff
path: root/mysql-test/t/count_distinct2.test
diff options
context:
space:
mode:
authorunknown <sasha@mysql.sashanet.com>2001-05-12 17:52:54 -0600
committerunknown <sasha@mysql.sashanet.com>2001-05-12 17:52:54 -0600
commit64984296241873f90e39d744b59690c7b3b408bb (patch)
tree21b4d45558a445f285ffe318246b699a11303126 /mysql-test/t/count_distinct2.test
parent1d56c0324e21e0e1b92e46445a8896006cb9a8e8 (diff)
downloadmariadb-git-64984296241873f90e39d744b59690c7b3b408bb.tar.gz
fixes/optimizations for count(distinct)
more extensive testing of count(distinct) sql/item_sum.cc: fixes/optimizations for count(distinct)
Diffstat (limited to 'mysql-test/t/count_distinct2.test')
-rw-r--r--mysql-test/t/count_distinct2.test42
1 files changed, 42 insertions, 0 deletions
diff --git a/mysql-test/t/count_distinct2.test b/mysql-test/t/count_distinct2.test
new file mode 100644
index 00000000000..cfdce77622c
--- /dev/null
+++ b/mysql-test/t/count_distinct2.test
@@ -0,0 +1,42 @@
+create table t1(n1 int, n2 int, s char(20), vs varchar(20), t text);
+insert into t1 values (1,11, 'one','eleven', 'eleven'),
+ (1,11, 'one','eleven', 'eleven'),
+ (2,11, 'two','eleven', 'eleven'),
+ (2,12, 'two','twevle', 'twelve'),
+ (2,13, 'two','thirteen', 'foo'),
+ (2,13, 'two','thirteen', 'foo'),
+ (2,13, 'two','thirteen', 'bar'),
+ (NULL,13, 'two','thirteen', 'bar'),
+ (2,NULL, 'two','thirteen', 'bar'),
+ (2,13, NULL,'thirteen', 'bar'),
+ (2,13, 'two',NULL, 'bar'),
+ (2,13, 'two','thirteen', NULL);
+
+select distinct n1 from t1;
+select count(distinct n1) from t1;
+
+select distinct n2 from t1;
+select count(distinct n2) from t1;
+
+select distinct s from t1;
+select count(distinct s) from t1;
+
+select distinct vs from t1;
+select count(distinct vs) from t1;
+
+select distinct t from t1;
+select count(distinct t) from t1;
+
+select distinct n1,n2 from t1;
+select count(distinct n1,n2) from t1;
+
+select distinct n1,s from t1;
+select count(distinct n1,s) from t1;
+
+select distinct s,n1,vs from t1;
+select count(distinct s,n1,vs) from t1;
+
+select distinct s,t from t1;
+select count(distinct s,t) from t1;
+
+select count(distinct n1), count(distinct n2) from t1;