title: MySQL Rating/Voting system (accurratly ordering by best rated taking into account number of votes)
body: <p>Let's say I have a MySQL table that is something like this:</p>
  
  <p>software table:</p>
  
  <pre><code>id int
  name text
  votes int
  rating int
  </code></pre>
  
  <p>Where votes would be the number of times someone has voted for that item and rating would be the average of those votes.</p>
  
  <p>Example data:</p>
  
  <pre><code>id: 0
  name: FooBar!
  votes: 5
  rating: 3
  </code></pre>
  
  <p>Now another user comes along and rates this a 1. How would I caculate the new rating? would be be better to just make another table and enter a new row every time someone votes like</p>
  
  <pre><code>id int
  software_id int
  score int
  user_id int
  </code></pre>
  
  <p>and then calculate the re-calculate the average rating every time? I would think it would take a toll on the server.</p>
  
  <p>Second question:</p>
  
  <p>I'd like to be able to order the software by the highest rated but I don't want a program with an average 5 star rating but only 1 vote to rank higher than a program with an average of 4 with 893 votes. How would I accomplish this?</p>