title: SQL statement to get largest ID from database column
body: <p>I have an ID column which it supposed to set to auto-increment but I forgot to set in when creating the database. Let's say the ID is from 1 - 20. I used the select Max() Sql statement to get the largest ID:</p>
  
  <pre><code>SELECT MAX(id) FROM Table_Name;
  </code></pre>
  
  <p>It supposed to return me 20. However, it returns me 9. I also realized that the id column in database is jumbled up. It starts from 1,2 then skips to 9,10 - 20 then back to 3 - 8. And 8 appears to be the last row and I think that's where the 9 comes from. My id in database is varchar() data type.</p>
  
  <p>So, is there any way to amend my Sql statement to get the largest id in a list of sorted id?</p>
  
  <p>Thanks in advance.</p>