----------------------------------聚合函数----------------------------------
在mysql中函数使用select关键字调用: select 函数名(字段名) from 表名‘
找出最大值: max (字段名):
select max(列名) as 别名 from 表名;
找出最小值: min (字段名):
select min(列名) as 别名 ,别的列名也能显示 from 表名;
求平均数: avg(字段名):
select avg(列名) from 表名;
求和(sum):
select sum(列名) from 表名;
统计记录count();
统计有多少条记录;
count(列名):如果字段的值为null,则此字段对应的数据条数将不再统计之内
为了解决上述问题 , 在统计某一张表中的所有数据记录时,最好使用count(*);
select count(列名) from 表名;
原文:https://www.cnblogs.com/xiaocaonb/p/12917431.html