Courseiva

DA0-002 Data Acquisition and Preparation Practice Question

Exhibit

Refer to the exhibit.
SELECT customer_id, COUNT(order_id) AS order_count
FROM orders
WHERE order_date BETWEEN '2023-01-01' AND '2023-12-31'
GROUP BY customer_id
HAVING COUNT(order_id) > 5;

An analyst is reviewing the above SQL query used to acquire data. What does this query retrieve?

⚠ Common exam trap

Watch out — candidates often confuse the comparison operator '>' with '>=', leading candidates to mistakenly include customers with exactly 5 orders when the query explicitly excludes them.

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 placed more than 5 orders in 2023

The SQL query uses a HAVING clause with COUNT(*) > 5 to filter customers who placed more than 5 orders in 2023. The WHERE clause restricts records to the year 2023, and the GROUP BY customer_id aggregates orders per customer. The condition '> 5' explicitly excludes customers with exactly 5 or fewer orders, making option A correct.

Answer analysis

Option-by-option breakdown

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

  • ✓

    Customers who placed more than 5 orders in 2023

    Why this is correct

    The query groups orders by customer, filters transactions to the 2023 calendar year, applies a HAVING clause counting orders per customer, and returns only those exceeding five. This yields the set of customers meeting that order-frequency threshold within the specified period.

  • ✗

    All customers who placed at least 5 orders in 2023

    Why it's wrong here

    A HAVING COUNT(*) >= 5 clause returns customers meeting a minimum, but the query's predicate uses a different comparison, so this threshold is wrong. It is tempting because HAVING with COUNT is the standard way to filter groups, and it would be correct if the stem's query specified at least five orders.

  • ✗

    The total number of orders per customer in 2023

    Why it's wrong here

    Returning a count per customer requires GROUP BY customer with COUNT(*) in the SELECT list, which the query does not project. It is tempting because GROUP BY with COUNT is the standard aggregation pattern, and it would be correct where the requirement is to display each customer's order volume rather than filter customers by it.

  • ✗

    Customers who placed exactly 5 orders in 2023

    Why it's wrong here

    A HAVING COUNT(*) = 5 predicate would return customers with exactly five orders, but the query filters on a different threshold, so this count is wrong. It is tempting because HAVING with COUNT is the standard pattern for per-customer order thresholds, and it would be correct if the stem's query used equality rather than a minimum.

About these practice questions

This DA0-002 question is part of Courseiva's 1,004-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.