Scenario: A DBA needs to find the average salary of all employees in a department. Which aggregation function should they use in DB2, and why?

  • AVG()
  • SUM()
  • COUNT()
  • MAX()
The correct option is AVG(). AVG() is used to calculate the average of a set of values. In this scenario, the DBA needs to find the average salary, which requires calculating the mean of all salaries in the department. SUM() calculates the total sum of values, COUNT() counts the number of rows, and MAX() returns the maximum value. 
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *