StackOverflow 文档 SQL 教程 功能(聚合) 和 和 Created: November-22, 2018 Sum 函数求和组中所有行的值。如果省略 group by 子句,则对所有行求和。 select sum(salary) TotalSalary from employees; TotalSalary 2500 select DepartmentId, sum(salary) TotalSalary from employees group by DepartmentId; DepartmentID TotalSalary 1 2000 2 500 AVG()列出连接