Exam Certified Data Analyst Associate All QuestionsBrowse all questions from this exam
Question 23

A data analyst has been asked to use the below table sales_table to get the percentage rank of products within region by the sales:

The result of the query should look like this:

Which of the following queries will accomplish this task?

    Correct Answer: B

    The correct answer involves calculating the percentage rank of products within a region by sales without aggregating the data. The key function to use here is PERCENT_RANK() OVER(PARTITION BY ... ORDER BY ... ASC). Option B utilizes this function appropriately to partition the data by region and order by sales, which aligns with the requirement to rank the products within each region based on their sales. While the concern regarding the GROUP BY clause is noted, it does not affect the logic and the execution of the query itself. Therefore, among the given options, B is the correct choice.

Discussion
DevscopeOption: B

Given all the other answers, B is the one that makes more sense However the GROUP BY clause does not make sense, we are not aggregating anything in this case, and it is not even possible to run that query without having an error. Anyone with a different idea?

MrWood47Option: B

Provided answer is correct

d046bc0Option: B

Percent_rank is used to have ranking from 0 . Rank() returns 1 as the first number. B would be correct without GROUP BY clause. But looks better than other options ;/