summaryrefslogtreecommitdiff
path: root/mysql-test/r/distinct.result
diff options
context:
space:
mode:
authorunknown <gkodinov@mysql.com>2006-06-27 17:59:49 +0300
committerunknown <gkodinov@mysql.com>2006-06-27 17:59:49 +0300
commit6a4ec2e99dbc59317d2e3178cf48cbcb4af53a40 (patch)
tree84b7402efbe762fa258628ea34f82d36f147a126 /mysql-test/r/distinct.result
parentd0412ab8e01e8410bc6b78bd33cdb844dc580a40 (diff)
parent4b36c1d8ffa33a9684342f7bae969b0e163c469f (diff)
downloadmariadb-git-6a4ec2e99dbc59317d2e3178cf48cbcb4af53a40.tar.gz
Merge mysql.com:/home/kgeorge/mysql/4.1/B16458
into mysql.com:/home/kgeorge/mysql/5.0/B16458 sql/sql_select.cc: Auto merged mysql-test/r/distinct.result: merge 4.1->5.0 mysql-test/t/distinct.test: merge 4.1->5.0
Diffstat (limited to 'mysql-test/r/distinct.result')
-rw-r--r--mysql-test/r/distinct.result51
1 files changed, 51 insertions, 0 deletions
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index 89b17d69f40..a2ff10594e6 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -504,6 +504,57 @@ a 2 b
2 2 4
3 2 5
DROP TABLE t1,t2;
+CREATE TABLE t1(a INT PRIMARY KEY, b INT);
+INSERT INTO t1 VALUES (1,1), (2,1), (3,1);
+EXPLAIN SELECT DISTINCT a FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 3 Using index
+EXPLAIN SELECT DISTINCT a,b FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+EXPLAIN SELECT DISTINCT t1_1.a, t1_1.b FROM t1 t1_1, t1 t1_2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1_1 ALL NULL NULL NULL NULL 3 Using temporary
+1 SIMPLE t1_2 index NULL PRIMARY 4 NULL 3 Using index; Distinct
+EXPLAIN SELECT DISTINCT t1_1.a, t1_1.b FROM t1 t1_1, t1 t1_2
+WHERE t1_1.a = t1_2.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1_1 ALL PRIMARY NULL NULL NULL 3 Using temporary
+1 SIMPLE t1_2 eq_ref PRIMARY PRIMARY 4 test.t1_1.a 1 Using index; Distinct
+EXPLAIN SELECT a FROM t1 GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 3 Using index
+EXPLAIN SELECT a,b FROM t1 GROUP BY a,b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+EXPLAIN SELECT DISTINCT a,b FROM t1 GROUP BY a,b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+CREATE TABLE t2(a INT, b INT, c INT, d INT, PRIMARY KEY (a,b));
+INSERT INTO t2 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4);
+EXPLAIN SELECT DISTINCT a FROM t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL PRIMARY 8 NULL 3 Using index
+EXPLAIN SELECT DISTINCT a,a FROM t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL PRIMARY 8 NULL 3 Using index; Using temporary
+EXPLAIN SELECT DISTINCT b,a FROM t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL PRIMARY 8 NULL 3 Using index
+EXPLAIN SELECT DISTINCT a,c FROM t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using temporary
+EXPLAIN SELECT DISTINCT c,a,b FROM t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3
+EXPLAIN SELECT DISTINCT a,b,d FROM t2 GROUP BY c,b,d;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
+CREATE UNIQUE INDEX c_b_unq ON t2 (c,b);
+EXPLAIN SELECT DISTINCT a,b,d FROM t2 GROUP BY c,b,d;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3
+DROP TABLE t1,t2;
create table t1 (id int, dsc varchar(50));
insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line number three");
select distinct id, IFNULL(dsc, '-') from t1;