~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/func_group.result

  • Committer: Monty Taylor
  • Date: 2008-10-23 00:05:28 UTC
  • Revision ID: monty@inaugust.com-20081023000528-grdvrd8c4058nutm
Moved my_handler to myisam, which is where it actually belongs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
192
192
insert into t2 values('BBB', 20, 1.0);
193
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
581
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)
 
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),
 
602
  `min(a)` varchar(1)
 
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)
 
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
 
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)
 
876
0.33333 6
870
877
0.50000 6
 
878
0.66667 6
871
879
1.00000 18
872
880
1.50000 6
873
881
2.00000 6
874
882
3.00000 6
875
 
9999999999.99999        12
876
883
SELECT SUM(a) FROM t1 GROUP BY b/c;
877
884
SUM(a)
878
885
6
 
886
6
 
887
6
879
888
18
880
889
6
881
890
6
882
891
6
883
 
12
884
892
DROP TABLE t1;
885
893
set div_precision_increment= @sav_dpi;
886
894
CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
898
906
show create table t1;
899
907
Table   Create Table
900
908
t1      CREATE TABLE `t1` (
901
 
  `variance(0)` DOUBLE(8,4) DEFAULT NULL
902
 
) ENGINE=DEFAULT COLLATE = utf8_general_ci
 
909
  `variance(0)` double(8,4)
 
910
) ENGINE=InnoDB
903
911
drop table t1;
904
912
create table t1 select stddev(0);
905
913
show create table t1;
906
914
Table   Create Table
907
915
t1      CREATE TABLE `t1` (
908
 
  `stddev(0)` DOUBLE(8,4) DEFAULT NULL
909
 
) ENGINE=DEFAULT COLLATE = utf8_general_ci
 
916
  `stddev(0)` double(8,4)
 
917
) ENGINE=InnoDB
910
918
drop table t1;
911
919
create table bug22555 (i int primary key auto_increment, s1 int, s2 int, e decimal(30,10), o double);
912
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);
1074
1082
0.21325764
1075
1083
select std(o1/o2) from bug22555;
1076
1084
std(o1/o2)
1077
 
0.213257635866493
 
1085
0.2132576358664934
1078
1086
select std(e1/e2) from bug22555;
1079
1087
std(e1/e2)
1080
1088
0.21325764
1100
1108
0.21325763586649340
1101
1109
select std(o1/o2) from bug22555;
1102
1110
std(o1/o2)
1103
 
0.213257635866493
 
1111
0.2132576358664934
1104
1112
select round(std(e1/e2), 17) from bug22555;
1105
1113
round(std(e1/e2), 17)
1106
1114
0.21325763586649340
1125
1133
0.21325763586649340
1126
1134
select std(o1/o2) from bug22555;
1127
1135
std(o1/o2)
1128
 
0.213257635866493
 
1136
0.2132576358664934
1129
1137
select round(std(e1/e2), 17) from bug22555;
1130
1138
round(std(e1/e2), 17)
1131
1139
0.21325763586649340
1221
1229
INSERT INTO t2 ( a, b, c ) VALUES ( 1, NULL, 2 ), ( 1, 3, 4 ), ( 1, 4, 4 );
1222
1230
EXPLAIN SELECT MIN(b), MIN(c) FROM t2 WHERE a = 1;
1223
1231
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1224
 
1       SIMPLE  t2      ref     a       a       5       const   1       Using where
 
1232
1       SIMPLE  t2      ref     a       a       5       const   1       
1225
1233
SELECT MIN(b), MIN(c) FROM t2 WHERE a = 1;
1226
1234
MIN(b)  MIN(c)
1227
1235
3       2