Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A rank of a collection of records assigns a 1 to the top-most value (it is in 1st place), a 2 to the second highest

A rank of a collection of records assigns a 1 to the top-most value (it is in 1st place), a 2 to the second highest value (2nd place), and so forth. If multiple records have the same value, they are assigned the same rank, but there is a corresponding gap to the next rank value. For example, if you had the following values: 350 | 190 | 470 | 350

Their rank would be as follows: 1: 470 | 2: 350 | 2: 350 | 4: 190

In particular, note that no value has a rank of 3, because two values have a rank of 2.

If a value has a rank of 2, this means there is one other value that is greater. If a value has a rank of 4, there are three other values that are greater. Given this, it should be evident that you need to compare the set of records against itself in order to properly compute the rank.

Compute the rank of all bank branches, based on the amount of assets that each branch holds. The result schema should be (branch_name, assets, rank), where the rank value is the rank of that branch.

Hint 1: There are several approaches you can use to compute this result, but all of them will come down to the same general theme: joining the branches table against itself with a non-equality condition. We call these non-equijoins.

Hint 2: There are two branches with the same assets; make sure the rank values are correct for those branches and for the adjacent branches in the ranking.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago