nerdexam
DatabricksDatabricks

CERTIFIED-DATA-ANALYST-ASSOCIATE · Question #77

CERTIFIED-DATA-ANALYST-ASSOCIATE Question #77: Real Exam Question with Answer & Explanation

The correct answer is D: SELECT. Note: The actual SQL code for options A–D isn't visible in your question (each just shows "SELECT"), so I'll explain the concept based on the established correct answer pattern for this type of exam question. Option D is correct because ranking products within a region requires a

Question

A data analyst has been asked to use the below table sales_table to rank products within region by the sales: The result of the query should look like this: Which query will accomplish this task?

Options

  • ASELECT
  • BSELECT
  • CSELECT
  • DSELECT

Explanation

Note: The actual SQL code for options A–D isn't visible in your question (each just shows "SELECT"), so I'll explain the concept based on the established correct answer pattern for this type of exam question.

Option D is correct because ranking products within a region requires a window function with RANK() OVER (PARTITION BY region ORDER BY sales DESC). The PARTITION BY region clause resets the rank counter for each region, and ORDER BY sales DESC ensures highest sales gets rank 1 - matching the expected result set.

The distractors (A, B, C) typically fail in one of these ways: using ROW_NUMBER() instead of RANK() (which gives unique sequential numbers even for tied values, producing wrong output on ties), omitting PARTITION BY (which ranks across the entire table rather than within each region), or using ORDER BY sales ASC (which ranks the lowest sales as #1, reversing the intended result).

Memory tip: Think "PARTITION BY = reset the counter per group." If you need rank within a category, you always need PARTITION BY <category>. No PARTITION BY = global rank across all rows - a common trap in SQL window function questions.

Community Discussion

No community discussion yet for this question.

Full CERTIFIED-DATA-ANALYST-ASSOCIATE PracticeBrowse All CERTIFIED-DATA-ANALYST-ASSOCIATE Questions