Mysql基础第十六天,分组数据

Posted 2019ab

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mysql基础第十六天,分组数据相关的知识,希望对你有一定的参考价值。

分组数据

	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;  // 降序

以上是关于Mysql基础第十六天,分组数据的主要内容,如果未能解决你的问题,请参考以下文章

Python 基础学习第十六天

Python 基础学习第十六天

java基础第十六天_GUI/socket

IT十八掌作业_java基础第十六天_GUI/socket

Python 基础学习第十六天

Mysql第十六天,常用SQL技巧