Skip to content

Latest commit

 

History

History
52 lines (36 loc) · 1.78 KB

contest_leaderboard.md

File metadata and controls

52 lines (36 loc) · 1.78 KB

Back

Contest Leaderboard

https://app.codesignal.com/arcade/db/always-leave-table-in-order/WJ2bsam6YCAqgxFS9

Challenge description

You are working as a recruiter at a big IT company, and you're actively looking for candidates who take the top places in major programming contests. Since the grand finale of the annual City Competition, you've been reaching out to the top participants from the leaderboard, and successfully so.

You have already interviewed all the prize winners (the top 3 participants), but that's not enough right now. Your company needs more specialists, so now you would like to connect with the participants who took the next 5 places.

The contest leaderboard is stored in a table leaderboard with the following columns:

  • id: unique id of the participant;
  • name: the name of the participant;
  • score: the score the participant achieved in the competition.

The resulting table should contain the names of the participants who took the 4th to 8th places inclusive, sorted in descending order of their places. If there are fewer than 8 participants, the results should contain those who ranked lower than 3rd place.

It is guaranteed that there are at least 3 prize winners in the leaderboard and that all participants have different scores.

Example

For the following table leaderboard

id name score
1 gongy 3001
2 urandom 2401
3 eduardische 2477
4 Gassa 2999
5 bcc32 2658
6 Alex_2oo8 6000
7 mirosuaf 2479
8 Sparik 2399
9 thomas_holmes 2478
10 cthaeghya 2400

the output should be

name
bcc32
mirosuaf
thomas_holmes
eduardische
urandom

Solution

Solved with MySQL