BlackFriday 2024! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Databricks Exam Databricks-Certified-Data-Analyst-Associate 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:

Nana
24 days 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
29 days 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
Viki
6 days ago
Yeah, Option C looks like it would take forever to debug. I'd rather go with something more straightforward.
upvoted 0 times
...
Glen
7 days ago
I agree, Option C does seem overly complicated. I would prefer a simpler solution.
upvoted 0 times
...
...
Brice
2 months 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
18 days ago
Option B does look like the cleanest solution for this task. It's a good choice.
upvoted 0 times
...
Leanora
1 months ago
I agree, Option B seems like the most logical and efficient way to achieve the desired result.
upvoted 0 times
...
Asha
1 months ago
I think Option B is the best choice too. It's straightforward and efficient.
upvoted 0 times
...
...
Kip
2 months 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
2 months ago
Ah, I see what they're going for with the PERCENT_RANK() function. That should do the trick!
upvoted 0 times
...
Rosamond
2 months 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
2 months 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
26 days ago
Option B looks like it could be the right one based on the window function used.
upvoted 0 times
...
Michel
1 months ago
Maybe option B would be a better choice.
upvoted 0 times
...
Josefa
1 months ago
I think option A might not be using the correct window function.
upvoted 0 times
...
Noe
2 months ago
Have you tried using option A?
upvoted 0 times
...
...
Vi
2 months 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
2 months ago
I think the correct query is Option A because it includes the RANK() function.
upvoted 0 times
...

Save Cancel