分组数据

select count(vend_ic) from products where vend_id>10001;

创建分组

select count(prod_ic),vend_id,vend_price from products group by vend_price; // group by 分组数据

过滤分组

select count(vend_ic),vend_id from products where vend_id>10001 group by vend_id;//where vend_id>10001
select count(vend_ic),vend_id from products group by vend_id having(conunt(vend_ic)) >= 5;
select count(vend_ic),vend_id from products group by vend_id having(count(vend_ic)) between 3 and 10;

分组和排序

select count(vend_ic),vend_id from products group by vend_id order by count(vend_ic) desc;  // 降序

select子句顺序

select count(vend_ic),vend_id from products where vend_id>1000 group by vend_id having count(vend_ic)>1 order by count(vend_ic) desc;  // 降序