DA0-002 Data Acquisition and Preparation Practice Question
A data analyst wants to retrieve the top 5 highest-paid employees from the 'employees' table. Which SQL clauses could be used to achieve this? (Select TWO.)
⚠ Common exam trap
Watch out — candidates often confuse the roles of ORDER BY and LIMIT: candidates might think HAVING or GROUP BY can be used to get top N, or they might choose ascending order instead of descending.
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
✓
ORDER BY salary DESC
Option A, ORDER BY salary DESC, is correct because it sorts the result set by the salary column in descending order, placing the highest-paid employees first so the top earners can be identified. Option D, LIMIT 5, is correct because it restricts the result set to only the first 5 rows, which after the descending sort yields exactly the top 5 highest-paid employees. Together, ORDER BY salary DESC LIMIT 5 produces the desired result. Option C, ORDER BY salary ASC, is wrong because ascending order returns the lowest-paid employees first, the opposite of what is needed. Option B, HAVING salary, is wrong because HAVING filters groups after aggregation and is not used to sort or limit rows. Option E, GROUP BY salary, is wrong because grouping by salary aggregates rows by distinct salary values rather than selecting the top 5 individual employees.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
ORDER BY salary DESC
Why this is correct
ORDER BY salary DESC sorts the result set by the salary column in descending order, placing the highest-paid employees first. Combined with a limiting clause such as TOP 5 or FETCH FIRST 5 ROWS ONLY, it satisfies the stem's requirement to retrieve exactly the top five earners.
- ✗
HAVING salary
Why it's wrong here
HAVING filters grouped aggregate results and cannot rank or limit individual rows, so it returns no ordered top five. It is tempting because HAVING legitimately restricts aggregated output, which would be correct when filtering groups such as departments whose average salary exceeds a threshold.
- ✗
ORDER BY salary ASC
Why it's wrong here
Sorting ascending places the lowest-paid employees first, so a LIMIT 5 would return the bottom five, not the top five. It is tempting because ORDER BY is genuinely required for ranking queries; combined with DESC it would be the correct clause here.
- ✓
LIMIT 5
Why this is correct
LIMIT 5 restricts the result set to five rows, satisfying the top-5 constraint. Paired with ORDER BY on salary descending, it returns the highest-paid employees; without that sort, LIMIT alone returns an arbitrary five rows.
- ✗
GROUP BY salary
Why it's wrong here
GROUP BY collapses rows into one per distinct salary value and cannot rank individual employees, so it never yields the top five earners. It is tempting because GROUP BY pairs with aggregate functions, which would be correct when summarising salaries per department rather than selecting employees.
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 →
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.