The correct answer is that the HAVING clause is used to filter groups after aggregation. This is because SQL processes queries in a specific order: the WHERE clause filters individual rows before any grouping occurs, but once the GROUP BY clause creates aggregated groups and functions like SUM, COUNT, or AVG are applied, only the HAVING clause can impose conditions on those aggregated results. On the CompTIA Data+ DA0-001 exam, this distinction is a frequent test point, often appearing in questions that ask you to choose between WHERE and HAVING. A common trap is confusing the two: remember that WHERE cannot reference aggregate functions, while HAVING can. For a quick memory tip, think of HAVING as the “group filter” that comes after the party (aggregation) has started, whereas WHERE is the bouncer at the door checking individual guests before they enter.
DA0-001 Mining and Acquiring Data Practice Question
This DA0-001 practice question tests your understanding of mining and acquiring data. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
Exhibit
Refer to the exhibit.
```
SELECT customer_id, COUNT(order_id) AS order_count
FROM orders
GROUP BY customer_id
HAVING COUNT(order_id) > 5
ORDER BY order_count DESC;
```
What is the primary purpose of the HAVING clause in the query shown?
Clue words in this question
Noticing these words before you look at the options changes how you read each choice.
Clue: "primary"
Why it matters: Asks for the main purpose or function, not a secondary benefit. Eliminate answers that describe side-effects or partial functions.
Refer to the exhibit.
```
SELECT customer_id, COUNT(order_id) AS order_count
FROM orders
GROUP BY customer_id
HAVING COUNT(order_id) > 5
ORDER BY order_count DESC;
```
A
Sort the results in descending order
Why wrong: Sorting is done by ORDER BY.
B
Join two tables
Why wrong: Joins are performed using JOIN clauses.
C
Filter rows before grouping
Why wrong: That is the purpose of WHERE, not HAVING.
D
Filter groups after aggregation
HAVING filters groups that meet the aggregate condition.
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Filter groups after aggregation
The HAVING clause is used to filter groups after the GROUP BY clause has aggregated the data. In SQL, WHERE filters individual rows before aggregation, while HAVING applies conditions to the results of aggregate functions like SUM, COUNT, or AVG. Option D is correct because the query uses HAVING to restrict which grouped results appear in the final output.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
✗
Sort the results in descending order
Why it's wrong here
Sorting is done by ORDER BY.
✗
Join two tables
Why it's wrong here
Joins are performed using JOIN clauses.
✗
Filter rows before grouping
Why it's wrong here
That is the purpose of WHERE, not HAVING.
✓
Filter groups after aggregation
Why this is correct
HAVING filters groups that meet the aggregate condition.
Clue confirmation
The clue word "primary" in the question point toward this answer.
Related concept
Read the scenario before looking for a memorised answer.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is confusing WHERE and HAVING: candidates often pick 'Filter rows before grouping' because they think all filtering happens before aggregation, but HAVING specifically filters groups after aggregation, not individual rows.
Detailed technical explanation
How to think about this question
Under the hood, SQL execution order processes FROM, JOIN, WHERE, GROUP BY, HAVING, SELECT, ORDER BY, and LIMIT sequentially. HAVING can reference aggregate functions and columns in the GROUP BY clause, but it cannot reference aliases defined in the SELECT unless the database supports it (e.g., MySQL allows this, but standard SQL does not). A real-world scenario is filtering departments with total sales over $10,000 after grouping by department_id, which requires HAVING SUM(sales) > 10000.
KKey Concepts to Remember
Read the scenario before looking for a memorised answer.
Find the constraint that changes the correct option.
Eliminate answers that are true in general but not in this case.
TExam Day Tips
→Watch for words such as best, first, most likely and least administrative effort.
→Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A practitioner preparing for the DA0-001 exam encounters this exact type of scenario on the job. The correct answer here is not the most general option — it is the best answer for the specific constraint described. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Real exam questions reward reading the full scenario before eliminating options, because the constraint defines which answer fits.
What to study next
Got this wrong? Here's your next step.
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
Mining and Acquiring Data — This question tests Mining and Acquiring Data — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: Filter groups after aggregation — The HAVING clause is used to filter groups after the GROUP BY clause has aggregated the data. In SQL, WHERE filters individual rows before aggregation, while HAVING applies conditions to the results of aggregate functions like SUM, COUNT, or AVG. Option D is correct because the query uses HAVING to restrict which grouped results appear in the final output.
What should I do if I get this DA0-001 question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
Are there clue words in this question I should notice?
Yes — watch for: "primary". Asks for the main purpose or function, not a secondary benefit. Eliminate answers that describe side-effects or partial functions.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
This DA0-001 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DA0-001 exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.