title: When using MySQL's GROUP BY, what guarantees are there about what data is put into the result?
body: <p>Suppose we want to find the max or min age for a person with a specific name.</p>
  
  <p>We can do:</p>
  
  <pre><code>select name, min(age) from users group by name;
  select name, max(age) from users group by name;
  </code></pre>
  
  <p><code>min</code> and <code>max</code> are clearly documented with other aggregate functions.</p>
  
  <p>Another way to (seemingly) accomplish the above is as follows:</p>
  
  <pre><code>select name, age from (select name, age from users order by age asc) sorted group by name;
  select name, age from (select name, age from users order by age desc) sorted group by name;
  </code></pre>
  
  <p>Although this works, it relies on the guarantee that when building a result set, MySQL will take the content from the first record found, in the case that there are multiple records for the group by field.</p>
  
  <p>I cannot find documentation that clearly states such a guarantee to be true. Is it?</p>