Courseiva

DA0-002 Data Acquisition and Preparation Practice Question

A data analyst wants to assign a unique sequential integer to each row in a result set, starting at 1, based on the order of the 'sales_amount' column descending. Which window function should be used?

⚠ Common exam trap

DA0-002 often tests the difference between ROW_NUMBER(), RANK(), and DENSE_RANK() — candidates pick RANK() or DENSE_RANK() forgetting that only ROW_NUMBER() guarantees unique sequential integers.

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

✓

ROW_NUMBER() OVER (ORDER BY sales_amount DESC)

ROW_NUMBER() assigns a unique sequential integer to each row starting at 1, with no ties and no gaps, based on the ORDER BY clause. Since the requirement is a unique sequential integer per row ordered by sales_amount DESC, ROW_NUMBER() is the correct function.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    DENSE_RANK() OVER (ORDER BY sales_amount DESC)

    Why it's wrong here

    DENSE_RANK() gives tied sales_amount values the same number without gaps, so duplicates appear and the sequence is not unique per row. It is tempting because it also orders descending, and it would be correct when ranking distinct values consecutively, such as medal positions, rather than numbering every row.

  • ✗

    RANK() OVER (ORDER BY sales_amount DESC)

    Why it's wrong here

    RANK() assigns identical ranks to tied sales_amount values, skipping subsequent integers, so rows are not uniquely numbered. It is tempting because it orders by sales_amount DESC, and it would be correct when tied values should share a rank, such as leaderboards, rather than a distinct sequential identifier.

  • ✗

    NTILE(1) OVER (ORDER BY sales_amount DESC)

    Why it's wrong here

    NTILE(1) divides the ordered result set into one bucket, so every row receives the value 1 rather than an incrementing integer. It is tempting because NTILE also orders by sales_amount DESC, and it would be correct for splitting rows into quartiles or deciles, not for sequential row numbering.

  • ✓

    ROW_NUMBER() OVER (ORDER BY sales_amount DESC)

    Why this is correct

    ROW_NUMBER() assigns a unique sequential integer to every row, starting at 1, with no ties or gaps. Ordering by sales_amount DESC satisfies the stem's ranking constraint, so the highest sale receives 1. RANK() and DENSE RANK() would repeat values for tied amounts, breaking the uniqueness requirement.

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 →

How Courseiva writes practice questions · Editorial policy

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.