--总数--count()--计算有多少男性selectcount(*)as 男性人数 from gwl where gender="男";--提取最大值--max--提取男性年龄最大值:selectmax(*)from gwl where age;--提取最小值--min--提取男性年龄最小值:selectmin(*)from gwl where age;--求和--sum--提取所有人的年龄的总和:selectsum(*)from gwl where age;--平均值--avg--提取平均值:selectavg(*)from gwl where age;--四舍五入--round--计算所有人的平均值保留两位小数:selectround(avg((*)),2)from gwl where age;
Mysql 数据库的聚合函数:--总数 --count() --计算有多少男性 select count(*) as 男性人数 from gwl where gender="男";--提取最大值 --max --提取男性年龄最大值: select max(*) from gwl where age;--提取最小值 --min --提取男性年龄最小值: select min(*) from gwl where age;--求和 --sum --提取所有人的年龄的总和: