title: How do MIN() and MAX() work on CHAR/VARCHAR strings in MySQL?
body: <p>I've been playing with the world database (InnoDB) found <a href="http://dev.mysql.com/doc/index-other.html" rel="noreferrer">here</a> to gain more insight into MySQL.</p>
  
  <p>I entered the following basic query:</p>
  
  <pre><code>SELECT COUNT(Name), MIN(Name), MAX(Name)
  FROM Country
  GROUP BY Continent
  </code></pre>
  
  <p>It seems that the way MIN() and MAX() work on the CHAR strings in Name is by alphabetical order, where A is the smallest value and Z is the greatest and so forth.</p>
  
  <p>Can anyone explain what is going on behind the scenes and what values strings are being assigned for them to be sorted in such a way? What would happen with strings of both alphabetic characters and integers, or special characters?</p>
  
  <p>Insight much appreciated.</p>