Oracle Database 12c: SQL Fundamentals — Question 54
Which statements are true regarding the WHERE and HAVING clauses in a SELECT statement?
(Choose all that apply.)
Answer options
- A. The HAVING clause can be used with aggregate functions in subqueries.
- B. The WHERE clause can be used to exclude rows after dividing them into groups.
- C. The WHERE clause can be used to exclude rows before dividing them into groups.
- D. The aggregate functions and columns used in the HAVING clause must be specified in the SELECT list of the query.
- E. The WHERE and HAVING clauses can be used in the same statement only if they are applied to different columns in the table. AC
Correct answer:
Explanation
Option A is correct because the HAVING clause can indeed be used with aggregate functions in subqueries. Option C is correct as the WHERE clause is designed to filter rows before any grouping takes place. Options B, D, and E are incorrect; B misrepresents the function of the WHERE clause, D is not a requirement, and E is not true as both clauses can reference the same columns.