title: MySQL query to assign a unique random number to each row
body: <p>I wish to attach a column to my table which will be a random number from a sequential list = to the number of rows.</p>
  
  <p>So, if my table had <strong>999 rows</strong>, then <strong>the numbers 1 to 999 would be assigned randomly and uniquely</strong>.</p>
  
  <p>Now, I figured that I could add a dummy TempRandomColumn=Rand(), sort by that and add the numbers sequentially using PHP. But that means 999 MySQL statements.</p>
  
  <p>Is there a way to do this using a single MySQL statement?</p>
  
  <p>Thanks for any pointers.</p>