I have a table with a simple schema: user_id, score and I would like to extract the n records with the highest score, such that each user_id is only represented once.
This question is similar to Get top n records for each group of grouped results except that instead of needing n representatives per group, I need n representatives of the table, with a maximum of one record per group.
As such, if i'm looking for n=3, running the query on:
user_id | score
      1 |    10
      2 |     9
      1 |    11
      2 |     8
      3 |     8
      4 |    12
should yield:
user_id | score
      4 |     12
      1 |     11
      2 |      9
 
     
    