~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/func_group.result

  • Committer: Brian Aker
  • Date: 2009-02-21 00:18:15 UTC
  • Revision ID: brian@tangent.org-20090221001815-x20e8h71e984lvs1
Completion (?) of uint conversion.

Show diffs side-by-side

added added

removed removed

Lines of Context:
176
176
select max(t1.a1), max(t2.a2) from t1, t2;
177
177
max(t1.a1)      max(t2.a2)
178
178
NULL    NULL
179
 
select max(t1.a1) from t1, t2 where t1.a1 > 0;
 
179
select max(t1.a1) from t1, t2;
180
180
max(t1.a1)
181
181
NULL
182
182
select max(t2.a2), max(t1.a1) from t1, t2;
190
190
1       SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    No matching min/max row
191
191
insert into t2 values('AAA', 10, 0.5);
192
192
insert into t2 values('BBB', 20, 1.0);
193
 
select t1.a1, t1.a2, t2.a1, t2.a2 from t1,t2 where t1.a1 > 0;
 
193
select t1.a1, t1.a2, t2.a1, t2.a2 from t1,t2;
194
194
a1      a2      a1      a2
 
195
10      aaa     AAA     10
 
196
10      aaa     BBB     20
195
197
10      NULL    AAA     10
196
198
10      NULL    BBB     20
197
 
10      aaa     AAA     10
198
 
10      aaa     BBB     20
199
199
10      bbb     AAA     10
200
200
10      bbb     BBB     20
201
201
20      zzz     AAA     10
529
529
explain 
530
530
select min(a1) from t1 where a1 > 'KKK' or a1 < 'XXX';
531
531
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
532
 
1       SIMPLE  t1      index   PRIMARY PRIMARY 14      NULL    15      Using where; Using index
 
532
1       SIMPLE  t1      range   PRIMARY PRIMARY 0       NULL    7       Using where; Using index
533
533
explain 
534
534
select min(a1) from t1 where a1 != 'KKK';
535
535
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
578
578
explain
579
579
select concat(min(t1.a1),min(t2.a4)) from t1, t2 where t2.a4 <> 'AME';
580
580
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
581
 
1       SIMPLE  t2      range   k2      k2      15      NULL    6       Using where; Using index
 
581
1       SIMPLE  t2      index   k2      PRIMARY 14      NULL    7       Using where
582
582
1       SIMPLE  t1      index   NULL    PRIMARY 14      NULL    15      Using index; Using join buffer
583
583
drop table t1, t2;
 
584
create table t1 (a char(10));
 
585
insert into t1 values ('a'),('b'),('c');
 
586
select coercibility(max(a)) from t1;
 
587
coercibility(max(a))
 
588
2
 
589
drop table t1;
584
590
create table t1 (a char);
585
591
insert into t1 values ('a'),('b');
586
592
show create table t1;
587
593
Table   Create Table
588
594
t1      CREATE TABLE `t1` (
589
 
  `a` VARCHAR(1) COLLATE utf8_general_ci DEFAULT NULL
590
 
) ENGINE=DEFAULT COLLATE = utf8_general_ci
 
595
  `a` varchar(1) DEFAULT NULL
 
596
) ENGINE=InnoDB
591
597
create table t2 select max(a),min(a) from t1;
592
598
show create table t2;
593
599
Table   Create Table
594
600
t2      CREATE TABLE `t2` (
595
 
  `max(a)` VARCHAR(1) COLLATE utf8_general_ci DEFAULT NULL,
596
 
  `min(a)` VARCHAR(1) COLLATE utf8_general_ci DEFAULT NULL
597
 
) ENGINE=DEFAULT COLLATE = utf8_general_ci
 
601
  `max(a)` varchar(1) DEFAULT NULL,
 
602
  `min(a)` varchar(1) DEFAULT NULL
 
603
) ENGINE=InnoDB
598
604
drop table t2;
599
605
create table t2 select concat(a) from t1;
600
606
show create table t2;
601
607
Table   Create Table
602
608
t2      CREATE TABLE `t2` (
603
 
  `concat(a)` VARCHAR(1) COLLATE utf8_general_ci DEFAULT NULL
604
 
) ENGINE=DEFAULT COLLATE = utf8_general_ci
 
609
  `concat(a)` varchar(1) DEFAULT NULL
 
610
) ENGINE=InnoDB
605
611
drop table t2,t1;
606
612
create table t1 (a int);
607
613
insert into t1 values (1);
653
659
MIN(a)
654
660
NULL
655
661
DROP TABLE t1;
656
 
CREATE TEMPORARY TABLE t1 (
 
662
CREATE TABLE t1 (
657
663
id int NOT NULL auto_increment,
658
664
val enum('one','two','three') NOT NULL default 'one',
659
665
PRIMARY KEY  (id)
672
678
show create table t2;
673
679
Table   Create Table
674
680
t2      CREATE TABLE `t2` (
675
 
  `MAX(b)` DATETIME DEFAULT NULL
676
 
) ENGINE=DEFAULT COLLATE = utf8_general_ci
 
681
  `MAX(b)` datetime DEFAULT NULL
 
682
) ENGINE=InnoDB
677
683
drop table t1, t2;
678
684
create table t1(f1 datetime);
679
685
insert into t1 values (now());
680
686
create table t2 select f2 from (select max(now()) f2 from t1) a;
681
687
show columns from t2;
682
 
Field   Type    Null    Default Default_is_NULL On_Update
683
 
f2      DATETIME        YES             YES     
 
688
Field   Type    Null    Key     Default Extra
 
689
f2      datetime        YES             NULL    
684
690
drop table t2;
685
691
create table t2 select f2 from (select now() f2 from t1) a;
686
692
show columns from t2;
687
 
Field   Type    Null    Default Default_is_NULL On_Update
688
 
f2      DATETIME        YES             YES     
 
693
Field   Type    Null    Key     Default Extra
 
694
f2      datetime        YES             NULL    
689
695
drop table t2, t1;
690
696
CREATE TABLE t1(
691
697
id int PRIMARY KEY,
781
787
330000000
782
788
select 1e8 * min(df) from t1;
783
789
1e8 * min(df)
784
 
110000000
 
790
110000000.00000001
785
791
create table t3 (ifl int);
786
792
insert into t3 values(1), (2);
787
793
select cast(min(ifl) as decimal(5,2)) from t3;
838
844
(3,3,1), (3,3,2), (3,3,3);
839
845
SELECT b/c as v, a FROM t1 ORDER BY v;
840
846
v       a
 
847
0.33333 3
841
848
0.33333 1
842
849
0.33333 2
843
 
0.33333 3
844
850
0.50000 1
845
851
0.50000 2
846
852
0.50000 3
 
853
0.66667 2
847
854
0.66667 1
848
 
0.66667 2
849
855
0.66667 3
850
 
1.00000 1
851
 
1.00000 1
852
 
1.00000 1
853
 
1.00000 2
854
 
1.00000 2
855
 
1.00000 2
856
 
1.00000 3
857
 
1.00000 3
858
 
1.00000 3
 
856
1.00000 3
 
857
1.00000 2
 
858
1.00000 3
 
859
1.00000 1
 
860
1.00000 2
 
861
1.00000 3
 
862
1.00000 2
 
863
1.00000 1
 
864
1.00000 1
 
865
1.50000 3
 
866
1.50000 2
859
867
1.50000 1
860
 
1.50000 2
861
 
1.50000 3
862
868
2.00000 1
 
869
2.00000 3
863
870
2.00000 2
864
 
2.00000 3
 
871
3.00000 3
 
872
3.00000 2
865
873
3.00000 1
866
 
3.00000 2
867
 
3.00000 3
868
874
SELECT b/c as v, SUM(a) FROM t1 GROUP BY v;
869
875
v       SUM(a)
870
876
0.33333 6
900
906
show create table t1;
901
907
Table   Create Table
902
908
t1      CREATE TABLE `t1` (
903
 
  `variance(0)` DOUBLE(8,4) DEFAULT NULL
904
 
) ENGINE=DEFAULT COLLATE = utf8_general_ci
 
909
  `variance(0)` double(8,4) DEFAULT NULL
 
910
) ENGINE=InnoDB
905
911
drop table t1;
906
912
create table t1 select stddev(0);
907
913
show create table t1;
908
914
Table   Create Table
909
915
t1      CREATE TABLE `t1` (
910
 
  `stddev(0)` DOUBLE(8,4) DEFAULT NULL
911
 
) ENGINE=DEFAULT COLLATE = utf8_general_ci
 
916
  `stddev(0)` double(8,4) DEFAULT NULL
 
917
) ENGINE=InnoDB
912
918
drop table t1;
913
919
create table bug22555 (i int primary key auto_increment, s1 int, s2 int, e decimal(30,10), o double);
914
920
insert into bug22555 (s1, s2, e, o) values (53, 78, 11.4276528, 6.828112), (17, 78, 5.916793, 1.8502951), (18, 76, 2.679231, 9.17975591), (31, 62, 6.07831, 0.1), (19, 41, 5.37463, 15.1), (83, 73, 14.567426, 7.959222), (92, 53, 6.10151, 13.1856852), (7, 12, 13.92272, 3.442007), (92, 35, 11.95358909, 6.01376678), (38, 84, 2.572, 7.904571);
1076
1082
0.21325764
1077
1083
select std(o1/o2) from bug22555;
1078
1084
std(o1/o2)
1079
 
0.213257635866493
 
1085
0.2132576358664934
1080
1086
select std(e1/e2) from bug22555;
1081
1087
std(e1/e2)
1082
1088
0.21325764
1102
1108
0.21325763586649340
1103
1109
select std(o1/o2) from bug22555;
1104
1110
std(o1/o2)
1105
 
0.213257635866493
 
1111
0.2132576358664934
1106
1112
select round(std(e1/e2), 17) from bug22555;
1107
1113
round(std(e1/e2), 17)
1108
1114
0.21325763586649340
1127
1133
0.21325763586649340
1128
1134
select std(o1/o2) from bug22555;
1129
1135
std(o1/o2)
1130
 
0.213257635866493
 
1136
0.2132576358664934
1131
1137
select round(std(e1/e2), 17) from bug22555;
1132
1138
round(std(e1/e2), 17)
1133
1139
0.21325763586649340
1223
1229
INSERT INTO t2 ( a, b, c ) VALUES ( 1, NULL, 2 ), ( 1, 3, 4 ), ( 1, 4, 4 );
1224
1230
EXPLAIN SELECT MIN(b), MIN(c) FROM t2 WHERE a = 1;
1225
1231
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1226
 
1       SIMPLE  t2      ALL     a       NULL    NULL    NULL    3       Using where
 
1232
1       SIMPLE  t2      ref     a       a       5       const   1       
1227
1233
SELECT MIN(b), MIN(c) FROM t2 WHERE a = 1;
1228
1234
MIN(b)  MIN(c)
1229
1235
3       2