聚合函数
名称 描述
Avg() 平均值
Count() 计数
Max() 最大值
Min() 最小值
Sum() 求和
AVG() - 平均值
SELECT ROUND(AVG(goods_price),2) AS avg_price FROM tdb_goods;
注:avg(2,5,8);不可以这样写
COUNT() - 计数
SELECT COUNT(goods_id) as counts FROM tdb_goods;
MAX() - 最大值
SELECT MAX(goods_price) as counts FROM tdb_goods;
MIN() - 最小值
SUM() - 求和
SELECT SUM(goods_price) as counts FROM tdb_goods;