New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Databricks Certified Data Analyst Associate Exam - Topic 3 Question 24 Discussion

Actual exam question for Databricks's Databricks Certified Data Analyst Associate exam
Question #: 24
Topic #: 3
[All Databricks Certified Data Analyst Associate Questions]

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?

A)

B)

C)

Show Suggested Answer Hide Answer
Suggested Answer: B

The correct query to get the percentage rank of products within region by the sales is option B. This query uses the PERCENT_RANK() window function to calculate the relative rank of each product within each region based on the sales amount. The window function is partitioned by region and ordered by sales in descending order. The result is aliased as rank and displayed along with the region and product columns. The other options are incorrect because:

A) Option A uses the RANK() window function instead of the PERCENT_RANK() function. The RANK() function returns the rank of each row within the partition, but not the percentage rank. Also, the query does not have a GROUP BY clause, which is required for aggregate functions like SUM().

C) Option C uses the DENSE_RANK() window function instead of the PERCENT_RANK() function. The DENSE_RANK() function returns the rank of each row within the partition, but not the percentage rank. Also, the query does not have a GROUP BY clause, which is required for aggregate functions like SUM().

D) Option D uses the ROW_NUMBER() window function instead of the PERCENT_RANK() function. The ROW_NUMBER() function returns the sequential number of each row within the partition, but not the percentage rank. Also, the query does not have a GROUP BY clause, which is required for aggregate functions like SUM().Reference:

1: PERCENT_RANK (Transact-SQL)

2: Window functions in Databricks SQL

3: Databricks Certified Data Analyst Associate Exam Guide


Contribute your Thoughts:

0/2000 characters
Kathryn
3 months ago
Just a heads up, percentage rank can be tricky in SQL!
upvoted 0 times
...
Belen
3 months ago
Definitely going with Option D, it makes the most sense!
upvoted 0 times
...
Lai
3 months ago
Wait, are we sure about Option C? It seems off.
upvoted 0 times
...
Aleisha
4 months ago
I think Option A might actually work too.
upvoted 0 times
...
Val
4 months ago
Option B looks like the right choice for percentage rank.
upvoted 0 times
...
Gaynell
4 months ago
I feel like option A could be correct, but I need to double-check how the partitioning works in that context.
upvoted 0 times
...
Keneth
4 months ago
I’m a bit confused about the syntax for the ranking function. Was it `PERCENT_RANK()` or something else?
upvoted 0 times
...
Chaya
4 months ago
I think option B looks familiar; it might be similar to a practice question we did last week.
upvoted 0 times
...
Janella
5 months ago
I remember we practiced calculating percentage ranks, but I’m not sure if it was specifically by region.
upvoted 0 times
...
Heike
5 months ago
I've seen similar problems before, so I think I've got a good strategy for this. I'll focus on using the right window function and making sure the ranking is calculated correctly within each region.
upvoted 0 times
...
Timmy
5 months ago
I'm a bit confused by the different options. I'll need to read through the question and the SQL queries more closely to understand what each one is doing.
upvoted 0 times
...
Eladia
5 months ago
Okay, let's break this down step-by-step. I'll need to use a window function to calculate the percentage rank within each region. I think Option B might be the way to go.
upvoted 0 times
...
Jolanda
5 months ago
Hmm, I'm not sure about this one. The percentage rank calculation seems a bit tricky. I'll need to think it through carefully.
upvoted 0 times
...
Dante
5 months ago
This looks like a pretty straightforward SQL problem. I think I can handle this one.
upvoted 0 times
...
Shoshana
5 months ago
Hmm, this seems like a tricky one. I'll need to think carefully about the different logging options and which one would be most helpful for diagnosing the slow behavior.
upvoted 0 times
...
Nana
1 year ago
Wait, where's the 'D) None of the above' option? You know, for those of us who just want to walk away from this whole thing.
upvoted 0 times
...
Dierdre
1 year ago
Option C? Really? That query looks like a hot mess. I'd rather not get my hands dirty with that one.
upvoted 0 times
Justine
1 year ago
I'm with you on that. Let's steer clear of Option C and find a better way to get the job done.
upvoted 0 times
...
Viki
1 year ago
Yeah, Option C looks like it would take forever to debug. I'd rather go with something more straightforward.
upvoted 0 times
...
Glen
1 year ago
I agree, Option C does seem overly complicated. I would prefer a simpler solution.
upvoted 0 times
...
...
Brice
1 year ago
I'm going with Option B. It's the most elegant solution and gets the job done without any unnecessary complexity.
upvoted 0 times
Thaddeus
1 year ago
Option B does look like the cleanest solution for this task. It's a good choice.
upvoted 0 times
...
Leanora
1 year ago
I agree, Option B seems like the most logical and efficient way to achieve the desired result.
upvoted 0 times
...
Asha
1 year ago
I think Option B is the best choice too. It's straightforward and efficient.
upvoted 0 times
...
...
Kip
1 year ago
Woah, hold up! Using a subquery just to get the percentage rank? That seems a bit overkill, don't you think?
upvoted 0 times
...
Hildegarde
1 year ago
Ah, I see what they're going for with the PERCENT_RANK() function. That should do the trick!
upvoted 0 times
...
Rosamond
1 year ago
You might be right, I overlooked that detail. Option C does seem to be the most appropriate choice for this task.
upvoted 0 times
...
Hana
1 year ago
This query looks straightforward, but I'm not sure if it's using the right window function. Hmm, let me think this through.
upvoted 0 times
Matthew
1 year ago
Option B looks like it could be the right one based on the window function used.
upvoted 0 times
...
Michel
1 year ago
Maybe option B would be a better choice.
upvoted 0 times
...
Josefa
1 year ago
I think option A might not be using the correct window function.
upvoted 0 times
...
Noe
1 year ago
Have you tried using option A?
upvoted 0 times
...
...
Vi
1 year ago
I disagree, I believe Option C is the right query as it uses the PERCENT_RANK() function which is specifically mentioned in the question.
upvoted 0 times
...
Rosamond
1 year ago
I think the correct query is Option A because it includes the RANK() function.
upvoted 0 times
...

Save Cancel