Courseiva
Data AnalysiseasyMultiple ChoiceObjective-mapped

DA0-002 Data Analysis Practice Question

Exhibit

SELECT department, COUNT(*) as employee_count FROM employees WHERE hire_year > 2020 GROUP BY department HAVING COUNT(*) > 5;

Refer to the exhibit. Which clause is used to aggregate the data by department?

⚠ Common exam trap

CompTIA often tests the distinction between WHERE (row-level filter) and HAVING (group-level filter), leading candidates to confuse HAVING with GROUP BY when the question asks for the clause that performs aggregation.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

GROUP BY

The GROUP BY clause is used to aggregate data by department because it groups rows that have the same values in the specified column(s), allowing aggregate functions like SUM, AVG, or COUNT to be applied per group. In SQL, without GROUP BY, aggregate functions would operate on the entire result set, not per department.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • HAVING

    Why it's wrong here

    HAVING filters groups after aggregation, not the grouping itself.

  • WHERE

    Why it's wrong here

    WHERE filters rows before grouping, not used for grouping.

  • ORDER BY

    Why it's wrong here

    ORDER BY sorts the result set, not related to grouping.

  • GROUP BY

    Why this is correct

    GROUP BY groups rows by department, allowing COUNT to compute per-department totals.

About these practice questions

This DA0-002 question is part of Courseiva's 986-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This DA0-002 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-002 exam.