~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/group_min_max.result

  • Committer: Brian Aker
  • Date: 2010-04-05 23:46:43 UTC
  • Revision ID: brian@gaz-20100405234643-0he3xnj902rc70r8
Fixing tests to work with PBXT.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
drop table if exists t1;
2
 
create table t1 (
 
2
create TEMPORARY table t1 (
3
3
a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
4
4
) ENGINE=MYISAM;
5
5
insert into t1 (a1, a2, b, c, d) values
40
40
create index idx_t1_2 on t1 (a1,a2,b);
41
41
analyze table t1;
42
42
Table   Op      Msg_type        Msg_text
43
 
test.t1 analyze status  Table is already up to date
 
43
test.t1 analyze note    The storage engine for the table doesn't support analyze
44
44
drop table if exists t2;
45
 
create table t2 (
 
45
create TEMPORARY table t2 (
46
46
a1 char(64), a2 char(64) not null, b char(16), c char(16), d char(16), dummy char(64) default ' '
47
47
) ENGINE=MYISAM;
48
48
insert into t2 select * from t1;
68
68
create index idx_t2_2 on t2 (a1,a2,b);
69
69
analyze table t2;
70
70
Table   Op      Msg_type        Msg_text
71
 
test.t2 analyze status  Table is already up to date
 
71
test.t2 analyze note    The storage engine for the table doesn't support analyze
72
72
drop table if exists t3;
73
 
create table t3 (
 
73
create TEMPORARY table t3 (
74
74
a1 char(1), a2 char(1), b char(1), c char(4) not null, d char(3), dummy char(1) default ' '
75
75
) ENGINE=MYISAM;
76
76
insert into t3 (a1, a2, b, c, d) values
130
130
create index idx_t3_2 on t3 (a1,a2,b);
131
131
analyze table t3;
132
132
Table   Op      Msg_type        Msg_text
133
 
test.t3 analyze status  Table is already up to date
 
133
test.t3 analyze note    The storage engine for the table doesn't support analyze
134
134
explain select a1, min(a2) from t1 group by a1;
135
135
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
136
136
1       SIMPLE  t1      range   NULL    idx_t1_1        518     NULL    5       Using index for group-by
939
939
1       SIMPLE  t2      index   NULL    idx_t2_1        651     NULL    #       Using where; Using index
940
940
select a1,a2,b,       max(c) from t1 where (c > 'b1') group by a1,a2,b;
941
941
a1      a2      b       max(c)
 
942
a       a       a       d111
 
943
a       a       b       h112
 
944
a       b       a       l121
 
945
a       b       b       p122
 
946
b       a       a       d211
 
947
b       a       b       h212
 
948
b       b       a       l221
 
949
b       b       b       p222
 
950
c       a       a       d311
 
951
c       a       b       h312
 
952
c       b       a       l321
 
953
c       b       b       p322
 
954
d       a       a       d411
 
955
d       a       b       h412
 
956
d       b       a       l421
 
957
d       b       b       p422
942
958
select a1,a2,b,       max(c) from t1 where (c > 'f123') group by a1,a2,b;
943
959
a1      a2      b       max(c)
 
960
a       a       b       h112
 
961
a       b       a       l121
 
962
a       b       b       p122
 
963
b       a       b       h212
 
964
b       b       a       l221
 
965
b       b       b       p222
 
966
c       a       b       h312
 
967
c       b       a       l321
 
968
c       b       b       p322
 
969
d       a       b       h412
 
970
d       b       a       l421
 
971
d       b       b       p422
944
972
select a1,a2,b,       max(c) from t1 where (c < 'a0') group by a1,a2,b;
945
973
a1      a2      b       max(c)
946
974
select a1,a2,b,min(c),max(c) from t1 where (c < 'a0') group by a1,a2,b;
961
989
d       b       a       j421
962
990
select a1,a2,b,min(c),max(c) from t1 where (c < 'k321') group by a1,a2,b;
963
991
a1      a2      b       min(c)  max(c)
 
992
a       a       a       a111    d111
 
993
a       a       b       e112    h112
 
994
a       b       a       i121    k121
 
995
b       a       a       a211    d211
 
996
b       a       b       e212    h212
 
997
b       b       a       i221    k221
 
998
c       a       a       a311    d311
 
999
c       a       b       e312    h312
 
1000
c       b       a       i321    j321
 
1001
d       a       a       a411    d411
 
1002
d       a       b       e412    h412
 
1003
d       b       a       i421    j421
964
1004
select a1,a2,b,       max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
965
1005
a1      a2      b       max(c)
 
1006
a       a       a       d111
 
1007
a       a       b       h112
 
1008
a       b       a       l121
 
1009
a       b       b       p122
 
1010
b       a       a       d211
 
1011
b       a       b       h212
 
1012
b       b       a       l221
 
1013
b       b       b       p222
 
1014
c       a       a       d311
 
1015
c       a       b       h312
 
1016
c       b       a       l321
 
1017
c       b       b       p322
 
1018
d       a       a       d411
 
1019
d       a       b       h412
 
1020
d       b       a       l421
 
1021
d       b       b       p422
966
1022
select a1,a2,b,       max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
967
1023
a1      a2      b       max(c)
968
1024
a       a       a       d111
1001
1057
d       b       b       m422    p422
1002
1058
select a1,a2,b,min(c),max(c) from t1 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;
1003
1059
a1      a2      b       min(c)  max(c)
 
1060
a       a       a       c111    d111
 
1061
a       a       b       e112    g112
 
1062
b       a       a       b211    d211
 
1063
b       a       b       e212    f212
 
1064
c       a       a       b311    d311
 
1065
c       a       b       e312    f312
 
1066
d       a       a       b411    d411
 
1067
d       a       b       e412    f412
1004
1068
select a1,a2,b,min(c),max(c) from t1 where (c < 'c5') or (c = 'g412') or (c = 'k421') group by a1,a2,b;
1005
1069
a1      a2      b       min(c)  max(c)
 
1070
a       a       a       a111    c111
 
1071
b       a       a       a211    c211
 
1072
c       a       a       a311    c311
 
1073
d       a       a       a411    c411
1006
1074
d       a       b       g412    g412
1007
1075
d       b       a       k421    k421
1008
1076
select a1,a2,b,min(c),max(c) from t1 where ((c > 'b111') and (c <= 'g112')) or ((c > 'd000') and (c <= 'i110')) group by a1,a2,b;
1009
1077
a1      a2      b       min(c)  max(c)
 
1078
a       a       a       c111    d111
 
1079
a       a       b       e112    h112
 
1080
b       a       a       b211    d211
 
1081
b       a       b       e212    h212
 
1082
c       a       a       b311    d311
 
1083
c       a       b       e312    h312
 
1084
d       a       a       b411    d411
 
1085
d       a       b       e412    h412
1010
1086
select a1,a2,b,min(c),max(c) from t1 where (c between 'b111' and 'g112') or (c between 'd000' and 'i110') group by a1,a2,b;
1011
1087
a1      a2      b       min(c)  max(c)
 
1088
a       a       a       b111    d111
 
1089
a       a       b       e112    h112
 
1090
b       a       a       b211    d211
 
1091
b       a       b       e212    h212
 
1092
c       a       a       b311    d311
 
1093
c       a       b       e312    h312
 
1094
d       a       a       b411    d411
 
1095
d       a       b       e412    h412
1012
1096
select a1,a2,b,       max(c) from t2 where (c > 'b1') group by a1,a2,b;
1013
1097
a1      a2      b       max(c)
1014
1098
a       a       a       d111
1281
1365
d       b       b       m422    p422
1282
1366
select a1,a2,b,min(c) from t1 where ((a1 > 'a') or (a1 < '9'))  and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c < 'h112') or (c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122')) group by a1,a2,b;
1283
1367
a1      a2      b       min(c)
 
1368
b       b       a       k221
 
1369
c       b       a       k321
 
1370
d       b       a       k421
1284
1371
select a1,a2,b,min(c) from t1 where ((a1 > 'a') or (a1 < '9'))  and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122') or (c < 'h112') or (c = 'c111')) group by a1,a2,b;
1285
1372
a1      a2      b       min(c)
 
1373
b       b       a       k221
 
1374
c       b       a       k321
 
1375
d       b       a       k421
1286
1376
select a1,a2,b,min(c) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1287
1377
a1      a2      b       min(c)
1288
1378
select a1,a2,b,min(c) from t1 where (ord(a1) > 97) and (ord(a2) + ord(a1) > 194) and (b = 'c') group by a1,a2,b;
1319
1409
d       b       a       i421    l421
1320
1410
select a1,a2,b,min(c) from t2 where ((a1 > 'a') or (a1 < '9'))  and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c < 'h112') or (c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122')) group by a1,a2,b;
1321
1411
a1      a2      b       min(c)
 
1412
b       b       a       k221
 
1413
c       b       a       k321
 
1414
d       b       a       k421
1322
1415
select a1,a2,b,min(c) from t2 where ((a1 > 'a') or (a1 < '9'))  and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122') or (c < 'h112') or (c = 'c111')) group by a1,a2,b;
1323
1416
a1      a2      b       min(c)
 
1417
b       b       a       k221
 
1418
c       b       a       k321
 
1419
d       b       a       k421
1324
1420
select a1,a2,b,min(c) from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1325
1421
a1      a2      b       min(c)
1326
1422
explain select a1,a2,b from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
1836
1932
c
1837
1933
d
1838
1934
drop table t1,t2,t3;
1839
 
create table t1 (c1 int not null,c2 int not null, primary key(c1,c2)) ENGINE=MYISAM;
 
1935
create TEMPORARY table t1 (c1 int not null,c2 int not null, primary key(c1,c2)) ENGINE=MYISAM;
1840
1936
insert into t1 (c1,c2) values
1841
1937
(10,1),(10,2),(10,3),(20,4),(20,5),(20,6),(30,7),(30,8),(30,9);
1842
1938
select distinct c1, c2 from t1 order by c2;
1869
1965
drop table t1;
1870
1966
CREATE TABLE t1 (a varchar(5), b int, PRIMARY KEY (a,b));
1871
1967
INSERT INTO t1 VALUES ('AA',1), ('AA',2), ('AA',3), ('BB',1), ('AA',4);
1872
 
OPTIMIZE TABLE t1;
1873
 
Table   Op      Msg_type        Msg_text
1874
 
test.t1 optimize        status  OK
 
1968
ALTER TABLE t1 ENGINE="DEFAULT";
1875
1969
SELECT a FROM t1 WHERE a='AA' GROUP BY a;
1876
1970
a
1877
1971
AA
2169
2263
2       1       3       2.0000
2170
2264
1       1       3       2.0000
2171
2265
DROP TABLE t1;
 
2266
CREATE TABLE t1 (a int, b int, c int, d int,
 
2267
KEY foo (c,d,a,b), KEY bar (c,a,b,d));
 
2268
INSERT INTO t1 VALUES (1, 1, 1, 1), (1, 1, 1, 2), (1, 1, 1, 3), (1, 1, 1, 4);
 
2269
INSERT INTO t1 SELECT * FROM t1;
 
2270
INSERT INTO t1 SELECT * FROM t1;
 
2271
INSERT INTO t1 SELECT a,b,c+1,d FROM t1;
 
2272
EXPLAIN SELECT DISTINCT c FROM t1 WHERE d=4;
 
2273
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
2274
1       SIMPLE  t1      range   NULL    foo     10      NULL    17      Using where; Using index for group-by
 
2275
SELECT DISTINCT c FROM t1 WHERE d=4;
 
2276
c
 
2277
1
 
2278
2
 
2279
DROP TABLE t1;