title: Optimise database high score ranking in arcade game
body: <p>I'm trying to add an online high-score table to my basic iOS app. I don't want it to be associated with GameCenter, so I want to store the high scores in my own database. When the users first open the app, they are prompted to enter a nickname for themselves which the highscores are saved under. In theory, the high score database would look like this:</p>
  
  <pre><code>userid  name      highscore
  1       james123  201       
  2       xXsamXx   98         
  </code></pre>
  
  <p>Where <code>userid</code> is auto-incrementing, <code>name</code> is their chosen nickname, and <code>highscore</code> is the highest score they have achieved, which is overwritten each time they break said score. </p>
  
  <p>To return a user's global rank in-game, I could <code>ORDER</code> the database by high-score and return their position. </p>
  
  <p><strong>This poses two issues that I want to solve</strong> - I don't want the entire database reordered whenever anyone gets a high score, and I'm also not sure how to return the same rank for two users with identical scores (as one column, i.e. user, will ultimately come before the other). How could I solve these two issues?</p>
  
  <p>Thanks!</p>