1. Learn
  2. /
  3. Courses
  4. /
  5. PostgreSQL Summary Stats and Window Functions

Connected

Exercise

Summarizing results

After ranking each country in the 2000 Olympics by gold medals awarded, you want to return the top 3 countries in one row, as a comma-separated string. In other words, turn this:

| Country | Rank |
|---------|------|
| USA     | 1    |
| RUS     | 2    |
| AUS     | 3    |
| ...     | ...  |

into this:

USA, RUS, AUS

Instructions 1/2

undefined XP
    1
    2
  • Rank countries by the medals they've been awarded.