我的表中有一个列的值是 FLOAT 类型。如何获得该列中所有项目的平均值?
select avg( columnname) from table;
这将对所有行进行平均。要对子集进行平均,请使用
where
子句。要对(某事物)每组进行平均,请使用 group by
子句。
select avg(col1) from table;
select avg(column) from table;
SELECT AVG(column) FROM ...