Courseiva

DA0-002 Data Acquisition and Preparation Practice Question

A data analyst needs to retrieve the top 5 most expensive products from a 'products' table sorted by price descending. Which TWO SQL clauses are required to achieve this? (Select TWO).

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 price DESC

ORDER BY price DESC (C) is required because it sorts the result set by the price column in descending order, placing the most expensive products first. LIMIT 5 (E) is required because it restricts the result set to only the first five rows returned after sorting, giving the top 5 most expensive products. Together, ORDER BY price DESC followed by LIMIT 5 produce exactly the requested output. The other options do not belong: HAVING COUNT(*) > 1 (A) filters grouped aggregate results, WHERE price > 100 (B) applies a fixed numeric filter rather than selecting the top 5, and GROUP BY price (D) aggregates rows by price instead of simply sorting and limiting them.

Answer analysis

Option-by-option breakdown

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

  • ✗

    HAVING COUNT(*) > 1

    Why it's wrong here

    HAVING filters grouped aggregate results, such as counts per group, and cannot rank or limit rows. It is tempting because HAVING appears alongside ORDER BY in aggregate queries, but the stem needs ORDER BY price DESC and TOP 5 (or LIMIT 5) to return the five most expensive products.

  • ✗

    WHERE price > 100

    Why it's wrong here

    A WHERE clause filters individual rows by a predicate; it cannot limit result count or order rows. It is tempting because filtering by price feels related to selecting expensive products, but the stem needs ORDER BY price DESC plus TOP 5 (or LIMIT 5) to rank and cap the output.

  • ✓

    ORDER BY price DESC

    Why this is correct

    ORDER BY price DESC sorts the result set by the price column in descending order, placing the most expensive products first. This directly satisfies the stem's requirement to rank products by price from highest to lowest, which the LIMIT clause then truncates to the top 5 rows.

  • ✗

    GROUP BY price

    Why it's wrong here

    GROUP BY collapses rows into aggregates per distinct price value, which neither sorts nor caps the result set. It is tempting because grouping is common in analytical queries, but the stem requires ORDER BY price DESC with TOP 5 (or LIMIT 5) to return the five highest-priced products.

  • ✓

    LIMIT 5

    Why this is correct

    LIMIT 5 caps the result set at five rows, satisfying the top-5 requirement. Paired with ORDER BY price DESC, which sorts products from most to least expensive, it returns exactly the five highest-priced products the analyst needs.

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 →

How Courseiva writes practice questions · Editorial policy

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.