Courseiva

DA0-002 Data Acquisition and Preparation Practice Question

Exhibit

SELECT customer_id, COUNT(*) as order_count FROM orders GROUP BY customer_id HAVING COUNT(*) > 5;

Refer to the exhibit. What does the query return?

⚠ Common exam trap

CompTIA often tests the distinction between 'at least' (>=) and 'more than' (>) in HAVING clauses, and candidates may misread the condition as including exactly 5 orders.

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

✓

Customers who have placed more than 5 orders.

The query uses a HAVING clause with COUNT(*) > 5, which filters groups (by customer ID) to only those with more than 5 orders. The GROUP BY customer ID ensures the count is per customer, so the result is customers who have placed more than 5 orders. Option C is correct because the condition is strictly greater than 5, not at least 5.

Answer analysis

Option-by-option breakdown

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

  • ✗

    All orders grouped by customer ID.

    Why it's wrong here

    The query's GROUP BY collapses rows per customer, but the HAVING clause filters those groups by an order-count threshold, so it returns only customers meeting that count rather than every customer's grouped orders. Grouping alone would be correct without the HAVING predicate.

  • ✗

    Customers who have placed at least 5 orders.

    Why it's wrong here

    The HAVING clause counts rows per customer, but the threshold in the exhibit is not 5, so customers with that exact order count are not the result set. It is tempting because HAVING with COUNT is precisely how you filter customers by order volume when the number matches.

  • ✓

    Customers who have placed more than 5 orders.

    Why this is correct

    The HAVING clause filters aggregated groups rather than individual rows, so COUNT(order_id) grouped by customer is compared against 5. Only customers whose order count exceeds that threshold are returned, excluding those with five or fewer orders.

  • ✗

    All customers who have placed orders.

    Why it's wrong here

    An inner join between customers and orders returns only customers having at least one matching order row, and duplicates customers with multiple orders; the exhibit's query does not do this. It is tempting because joins are the usual way to list customers with orders.

About these practice questions

One of 1,004 original DA0-002 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.