DA0-002 Data Analysis 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;
The exhibit shows an SQL query executed on an 'orders' table that contains 'order_id', 'customer_id', and 'order_date'. What is the purpose of this query?
⚠ Common exam trap
CompTIA often tests the distinction between WHERE and HAVING, and the trap here is confusing a count of orders per customer with a count of products or an average, leading candidates to pick option B or C.
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
✓
Identify customers who placed more than 5 orders in 2023
The query groups orders by customer_id and filters using a HAVING clause with COUNT(*) > 5, which counts the number of orders per customer. The WHERE clause restricts orders to those placed in 2023, so the result identifies customers who placed more than 5 orders in that year. This matches option D exactly.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Count total orders per customer regardless of date
Why it's wrong here
There is a date filter in WHERE clause.
- ✗
Calculate average order count per customer for 2023
Why it's wrong here
The query counts orders, not averages.
- ✗
Find products with more than 5 orders in 2023
Why it's wrong here
The query is about customers, not products.
- ✓
Identify customers who placed more than 5 orders in 2023
Why this is correct
The query filters by 2023 date and having count > 5.
Go deeper
Related to this question
About these practice questions
One of 986 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 →
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.