Skip to main contentSkip to solution

Which of the following aggregate function in SQL returns the total of the specified column?

Solution

✅ Correct Option: 2

SUM() is the SQL aggregate function that adds up all the values in the specified column and returns their total. For example, SELECT SUM(salary) FROM employee;\text{SELECT SUM(salary) FROM employee;} gives the total salary of all employees.


Option 1: COUNT(*) counts the number of rows, not the sum of a column.

Option 3: MAX() returns the largest value in the column.

Option 4: TOTAL() is not a standard SQL aggregate function, so the standard function for a column total is SUM().

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question