QuestionQ162

VerifiedReporting Aggregated Data Using the Group Functions

Examine the definition of the EMPLOYEES table:

Question Image

Which two queries will execute successfully?

Choose two
Explanation

WHERE can filter HIRE_DATE before rows are grouped, and SUM(salary) can then be calculated for each DEPT_ID. Oracle also supports nested aggregate functions; AVG(MAX(salary)) is valid when no grouping column is selected with the resulting overall aggregate. A HAVING condition cannot reference an ungrouped, nonaggregated HIRE_DATE, and selecting DEPT_ID with the nested aggregate expressions in the other statements is invalid because the outer aggregate returns an overall result.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!