DA0-002 Data Concepts and Environments Practice Question
A company's database has a table 'orders' with columns: order_id, customer_id, order_date, and total_amount. A data analyst needs to identify customers who have placed more than 5 orders in the past year. Which data concept should be used to group orders by customer and count them?
⚠ Common exam trap
Many exam-takers confuse filtering (WHERE) with aggregation (GROUP BY), thinking that a WHERE clause alone can count orders per customer, when in fact WHERE only filters rows and cannot produce grouped counts.
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
✓
Aggregation with GROUP BY
The requirement to count orders per customer requires grouping rows by customer_id and then applying a count function. The GROUP BY clause in SQL aggregates rows that share a common value (customer_id) into summary rows, and the COUNT function tallies the number of orders per group. This is the standard approach for such 'per-customer' aggregations.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Joining with other tables
Why it's wrong here
Joining combines columns from additional tables; the orders table already holds customer_id and order_date, so a join adds no grouping or counting capability. It is tempting because joins are the correct concept when required attributes, such as customer names or regions, reside in a separate table.
- ✗
Filtering with WHERE clause
Why it's wrong here
WHERE filters individual order rows before any aggregation, so it cannot count orders per customer or test whether that count exceeds five. It is tempting because filtering is the correct concept for restricting rows to the past year by order_date, which is a necessary preliminary step but not the grouping operation required.
- ✗
Sorting with ORDER BY
Why it's wrong here
ORDER BY only arranges result rows; it neither collapses rows per customer nor produces a count, so no threshold of five orders can be evaluated. It is tempting because sorting is the right concept when presenting ranked output, such as listing orders by total_amount descending, rather than aggregating per customer.
- ✓
Aggregation with GROUP BY
Why this is correct
Aggregation with GROUP BY satisfies the requirement to group orders by customer_id and count them. GROUP BY collapses rows sharing a customer_id into single groups, then COUNT() tallies each customer's orders. Filtering with HAVING COUNT(*) > 5 after grouping identifies those exceeding five orders in the past year, which WHERE cannot do on aggregates.
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 →
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.