4.7.2 统计
1. count计数
select count(*) from common_example001 where partition like 'teststream' limit 10;
图 4.7.2.1count
select count(*) as cnt from common_example001 where partition like 'teststream' limit 10;
图 4.7.2.2count
2. 简单统计
select sum(i1),max(i1),min(i1),count(i1),count(*) from common_example001 where partition like 'teststream' limit 10;
图 4.7.2.3简单统计
select sum(i1) as c1,max(i1) as c2,min(i1) as c3,count(i1) as c4,count(*) as c5 from common_example001 where partition like 'teststream' limit 10;
图 4.7.2.4简单统计
3. 分组
--分组查询
select s1,count(*) from common_example001
where partition like 'teststream'
group by s1
limit 10;
--分组排序
select s1,count(*),sum(i1) from common_example001
where partition like 'teststream'
group by s1
order by i1 asc
limit 10;