core reorg
[csql.git] / test / sql / Aggregate / wher_grp_having_limit.sql
blob42fcfd3e90e5f0a77c695d5d72cb3d28c6f943d5
1 echo create table t1(f1 char(10),f2 char(10),f3 int);
2 create table t1(f1 char(10),f2 char(10),f3 int);
3 insert into t1 values('s','y',5000);
4 insert into t1 values('p','q',4000);
5 insert into t1 values('z','y',2000);
6 insert into t1 values('p','y',3000);
7 insert into t1 values('c','q',1000);
8 insert into t1 values('z','y',1500);
9 insert into t1 values('s','y',3000);
10 insert into t1 values('c','t',2500);
11 insert into t1 values('s','p',2300);
12 insert into t1 values('c','q',4000);
13 insert into t1 values('c','y',5000);
14 insert into t1 values('c','p',3500);
15 echo select * from t1;
16 select * from t1;
17 echo select f2,avg(f3) from t1 group by f2;
18 select f2,avg(f3) from t1 group by f2;
19 echo select f2,avg(f3) from t1 where f3>=3000 group by f2 ;
20 select f2,avg(f3) from t1 where f3>=3000 group by f2 ;
21 echo select f2,avg(f3) from t1 where f3>=2000 group by f2 having avg(f3)>3000;
22 select f2,avg(f3) from t1 where f3>=2000 group by f2 having avg(f3)>3000;
23 echo select f2,avg(f3) from t1 where f3>=2000 group by f2 having avg(f3)>3000 limit 1;
24 select f2,avg(f3) from t1 where f3>=2000 group by f2 having avg(f3)>3000 limit 1;
25 echo select f2,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f2 having avg(f3)>3000;
26 select f2,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f2 having avg(f3)>3000;
27 echo select f1,f2,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>3000 ;
28 select f1,f2,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>3000 ;
29 echo select f2,f1,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>3000;
30 select f2,f1,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>3000;
31 echo select f2,f1,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>2000 ;
32 select f2,f1,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>2000 ;
33 echo select f2,f1,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>2000 limit 3 offset 2;
34 select f2,f1,avg(f3) from t1 where f3>=2000 or f2 = 'y' group by f1,f2 having avg(f3)>2000 limit 3 offset 2;