core reorg
[csql.git] / test / sql / Aggregate / innerjoin_aggregate.sql
blobcd344cab7677de56433a26e4d48308cb2ca8c1a7
1 CREATE TABLE t1(f1 int,f2 int,f3 char(15),f4 char(12));
2 INSERT INTO t1 VALUES(1,70,'Nihar Pital',NULL);
3 INSERT INTO t1 VALUES(2,70,'Bijay Sahoo','MGR');
4 INSERT INTO t1 VALUES(3,60,'Kisor Ambli','Developer');
5 INSERT INTO t1 VALUES(2,90,'Jiten Lenka','S/W');
6 INSERT INTO t1 VALUES(3,80,'Papu Paital',NULL);
7 INSERT INTO t1 VALUES(4,90,'Bhahmananda','MKTING');
8 echo SELECT * from t1;
9 SELECT * from t1;
10 CREATE TABLE t2(f1 int,f2 int,f3 char(15));
11 INSERT INTO t2 VALUES(1,30,'Nihar');
12 INSERT INTO t2 VALUES(20,7,'Bijay');
13 INSERT INTO t2 VALUES(3,60,'Kisor');
14 INSERT INTO t2 VALUES(2,40,'Jiten');
15 INSERT INTO t2 VALUES(3,8,'Papu ');
16 INSERT INTO t2 VALUES(1,80,'Bijay');
17 INSERT INTO t2 VALUES(2,7,'Rameswar');
18 echo SELECT * from t1;
19 SELECT * from t1;
20 echo select t1.f1,t1.f2,count(t1.f4),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 ;
21 select t1.f1,t1.f2,count(t1.f4),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 ;
22 echo select t1.f1,t1.f2,count(t1.f4),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 having count(t1.f4)<6 and count(t2.f3) >=7;
23 select t1.f1,t1.f2,count(t1.f4),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 having count(t1.f4)<6 and count(t2.f3) >=7;
24 echo select t1.f1,t1.f2,count(t1.f3),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 having avg(t1.f2)<70;
25 select t1.f1,t1.f2,count(t1.f3),count(t2.f3) from t1,t2 group by t1.f1,t1.f2 having avg(t1.f2)<70;