title: Integer vs String in database
body: <p>When defining datatypes in a database, I have always had a problem with choosing whether to use integers or strings to store certain 'numerical' data.</p>
  
  <p>Say I am building <a href="http://www.freewebmasterhelp.com/tutorials/phpmysql/2" rel="noreferrer">Yet</a> <a href="http://www.globalguideline.com/sql/SQL_Create_Index.php" rel="noreferrer">Another</a> <a href="http://www.thundersoftware.com/churchdb/sqltutorial/sql_tutorial.html" rel="noreferrer">Address</a> <a href="http://www.peacecomputers.com/addressbook/step7.html" rel="noreferrer">Book</a> and there is a post code field. Provided that post codes are <em>always</em> a 4 digit number, which data type do I store it as? Integer or string? Technically it is an integer, but I'm not doing any sort of calculations on it, I'm just spitting it out into a table. Would your opinion change if I want to sort the table by post code?</p>
  
  <p>Now, I'm not stupid. I do recognize a valid need for integers, such as page views and unique users or logged in users and guest users. But what about for storing how many files are in a torrent? Integer or string?</p>