Aggregating Data with Group Functions Flashcards
6 cards from real 1Z0-071 practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 6 Aggregating Data with Group Functions flashcards as text
Which is the correct order of clauses in a SELECT statement using GROUP BY and HAVING?
Answer: SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY
The correct order is SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY.
What is the output of SELECT MAX(salary) - MIN(salary) FROM employees?
Answer: The salary range across all employees
Oracle allows arithmetic between aggregate functions in the SELECT clause, returning the salary range.
A query uses GROUP BY department_id. Which column can appear in the SELECT list WITHOUT being inside an aggregate function?
Answer: department_id
Only department_id can appear unaggregated in SELECT because it is in the GROUP BY clause.
Which aggregate function is used to find the average salary per department?
Answer: AVG()
AVG() is the standard Oracle group function that computes the arithmetic mean of a numeric column.
What does GROUP BY ROLLUP(department_id, job_id) produce in addition to normal groups?
Answer: Subtotals for each department_id and a grand total
ROLLUP creates subtotal rows for each level of the grouping hierarchy plus a grand total row.
Which statement correctly nests group functions?
Answer: SELECT MAX(AVG(salary)) FROM employees GROUP BY department_id
Oracle allows nesting group functions one level deep when a GROUP BY clause is present.