DA0-002 Data Acquisition and Preparation Practice Question
A data analyst is writing a query to rank products by total sales amount within each category. They want ties to have the same rank and no gaps in the ranking sequence. Which window function should they use?
⚠ Common exam trap
DA0-002 often tests the distinction between RANK() (gaps after ties) and DENSE_RANK() (no gaps), and candidates frequently pick RANK() when the question specifies 'no gaps'.
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
✓
DENSE_RANK()
DENSE_RANK() assigns the same rank to tied rows and does not skip subsequent ranks, so if two products tie for rank 1, the next product receives rank 2 (no gap). This matches the requirement for ties to share a rank with no gaps in the sequence. It is the correct window function for this ranking behavior.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
ROW_NUMBER()
Why it's wrong here
ROW_NUMBER() gives every row a distinct sequential integer, so tied sales amounts receive different numbers rather than sharing a rank. It tempts because it numbers rows within each category partition, and would be correct when a unique position per row is required regardless of ties.
- ✓
DENSE_RANK()
Why this is correct
DENSE_RANK() assigns identical ranks to tied sales totals yet never skips subsequent numbers, satisfying the no-gaps constraint. RANK() would leave gaps after ties, while ROW_NUMBER() breaks ties arbitrarily. Partitioning by category and ordering by total sales amount yields the required per-category sequence.
- ✗
RANK()
Why it's wrong here
RANK() assigns tied rows the same rank but leaves gaps afterwards, so the next distinct value jumps (1,1,3), violating the no-gaps requirement. It tempts because it does handle ties identically, and would be correct when tied positions should share a rank and subsequent ranks may skip.
- ✗
NTILE()
Why it's wrong here
NTILE() divides rows into a specified number of roughly equal buckets, returning a bucket number rather than a rank based on sales value. It tempts because it partitions and orders rows, and would be correct for splitting products into quartiles or deciles by sales.
About these practice questions
Courseiva writes every DA0-002 question from scratch — 1,004 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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.