Sql Query To Use a ' SELECT ' statement with SUM() function.


To retrieve a sum of a numeric column in a record from the existing created table. Then we can use a ' SELECT ' statement with the SUM() function.

Statement 1 will retrieve the sum of the salary of all employees from the Employees table in the Employee DB Database.

Statement 2 will retrieve the sum of the salary of all employees whose employee_id is greater than 150 from the employees' table in the Employee DB Database

Enter - Select * from table_name;
SQL Query
SELECT SUM(salary) FROM employees; SELECT SUM(salary) FROM employees WHERE employee_id>150;
Output