QUERY: create table agga (a integer);
QUERY: create table aggb (b smallint);
QUERY: create table aggc (c float);
QUERY: create table aggd (d float8);
QUERY: insert into agga values (1);
QUERY: insert into agga values (1);
QUERY: insert into agga values (4);
QUERY: insert into agga values (3);
QUERY: select * from agga;
a  
-- 
1  
1  
4  
3  
QUERY: insert into aggb values (10);
QUERY: insert into aggb values (45);
QUERY: insert into aggb values (10);
QUERY: insert into aggb values (30);
QUERY: select * from aggb;
b   
--- 
10  
45  
10  
30  
QUERY: insert into aggc values (210.3);
QUERY: insert into aggc values (4.45);
QUERY: insert into aggc values (310);
QUERY: insert into aggc values (310);
QUERY: select * from aggc;
c      
------ 
210.3  
4.45   
310    
310    
QUERY: insert into aggd values ('-210.3'::float8);
QUERY: insert into aggd values ('210.3'::float8);
QUERY: insert into aggd values ('4.45'::float8);
QUERY: insert into aggd values ('10310.33336'::float8);
QUERY: insert into aggd values ('10310.33335'::float8);
QUERY: select * from aggd;
d            
------------ 
-210.3       
210.3        
4.45         
10310.33336  
10310.33335  
QUERY: select count(*) from agga;
count  
------ 
4      
QUERY: select count(*), avg(a) from agga;
count  avg  
------ ---- 
4      2    
QUERY: select avg(a), max(a) from agga;
avg  max  
---- ---- 
2    4    
QUERY: select sum(a), max(a) from agga;
sum  max  
---- ---- 
9    4    
QUERY: select avg(c) from aggc;
avg      
-------- 
208.687  
QUERY: select sum(c) from aggc;
sum     
------- 
834.75  
QUERY: select max(c) from aggc;
max  
---- 
310  
QUERY: select min(c) from aggc;
min   
----- 
4.45  
QUERY: select count(*), avg(a), sum(a), max(a), min(a) from agga;
count  avg  sum  max  min  
------ ---- ---- ---- ---- 
4      2    9    4    1    
QUERY: select count(*), avg(b), sum(b), max(b), min(b) from aggb;
count  avg  sum  max  min  
------ ---- ---- ---- ---- 
4      23   95   45   10   
QUERY: select count(*), avg(c), sum(c), max(c), min(c) from aggc;
count  avg      sum     max  min   
------ -------- ------- ---- ----- 
4      208.687  834.75  310  4.45  
QUERY: select count(*), avg(d), sum(d), max(d), min(d) from aggd;
count  avg          sum          max          min     
------ ------------ ------------ ------------ ------- 
5      4125.023342  20625.11671  10310.33336  -210.3  
QUERY: create table agge (e integer);
QUERY: select count(*) from agge;
count  
------ 
0      
QUERY: select avg(e) from agge;
avg  
---- 
0    
QUERY: select sum(e) from agge;
sum  
---- 
0    
QUERY: select sum(e) from agge;
sum  
---- 
0    
QUERY: select min(e) from agge;
min  
---- 
     
QUERY: create table aggf (x int, y int);
QUERY: insert into aggf (x) values (1);
QUERY: insert into aggf (y) values (2);
QUERY: insert into aggf values (10, 20);
QUERY: select * from aggf;
x   y   
--- --- 
1       
    2   
10  20  
QUERY: select count(*) from aggf;
count  
------ 
3      
QUERY: select count(x), count(y) from aggf;
count  count  
------ ------ 
2      2      
QUERY: select avg(x), avg(y) from aggf;
avg  avg  
---- ---- 
5    11   
QUERY: drop table agga;
QUERY: drop table aggb;
QUERY: drop table aggc;
QUERY: drop table aggd;
QUERY: drop table agge;
QUERY: drop table aggf;
