DA0-002 Data Acquisition and Preparation Practice Question
A data analyst runs the following query: SELECT DISTINCT city FROM customers. What is the primary purpose of using the DISTINCT keyword in this query?
⚠ Common exam trap
The trap is confusing DISTINCT with ORDER BY or COUNT, causing candidates to select an answer that describes sorting or counting rather than deduplication.
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
✓
To remove duplicate city names
The DISTINCT keyword in a SELECT statement eliminates duplicate rows from the result set. In 'SELECT DISTINCT city FROM customers', if multiple customers live in the same city, that city name appears only once in the output, producing a list of unique city values. DISTINCT operates on the entire row of selected columns, so if multiple columns are selected, the combination must be unique to be retained.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
To sort the cities alphabetically
Why it's wrong here
DISTINCT removes duplicate rows from the result set; it does not order output, and any apparent ordering is incidental. It is tempting because deduplicated results often look grouped or sorted, but alphabetical ordering requires an explicit ORDER BY city clause, which this query omits.
- ✗
To count the number of cities
Why it's wrong here
DISTINCT returns unique city values rather than a total; counting requires an aggregate such as COUNT(DISTINCT city). It does not tally rows. DISTINCT is appropriate when the analyst needs the list of unique cities themselves, not the number of customers or cities present.
- ✗
To filter cities that start with a specific letter
Why it's wrong here
DISTINCT removes duplicate rows from the result set; it does not restrict rows by value. Filtering cities beginning with a letter requires a WHERE clause with a LIKE or comparison predicate. DISTINCT would be the right tool when a column contains repeated values and only unique entries are wanted.
- ✓
To remove duplicate city names
Why this is correct
DISTINCT collapses duplicate rows in the result set, so each city name appears once. Applied to the single selected column, it returns the unique list of cities, eliminating repeated values that would otherwise appear for every matching customer record.
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 and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official CompTIA exam blueprint
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.