title: MySQL Query to XQuery
body: <p>I'm trying to get the equivalent of the following MySQL Query to an XQuery</p>
  
  <pre><code>SELECT S.Classification, COUNT(S.Classification) AS "No. Students", AVG(S.GPA) AS "AVG
      Class. GPA"
  FROM Student S
  GROUP BY S.Classification
  ORDER BY S.Classification ASC;
  </code></pre>
  
  <p>This outputs:
  <a href="http://i.stack.imgur.com/Iu0d4.png" rel="nofollow">http://i.stack.imgur.com/Iu0d4.png</a></p>
  
  <p>Where My Database looks like:</p>
  
  <pre><code>CREATE TABLE 'Student' (
  'StudentID' CHAR(9) NOT NULL,
  'Classification' CHAR(10) NULL DEFAULT NULL,
  'GPA` DOUBLE NULL DEFAULT NULL,
  'MentorID' CHAR(9) NULL DEFAULT NULL,
  'CreditHours' INT(11) NULL DEFAULT NULL,
  PRIMARY KEY ('StudentID')
  )
  </code></pre>
  
  <p>And in XML:</p>
  
  <pre><code>&lt;Document&gt;
    &lt;Table&gt;
      &lt;StudentID&gt;118784412&lt;/StudentID&gt;
      &lt;Classification&gt;Sophomore&lt;/Classification&gt;
      &lt;GPA&gt;3.19&lt;/GPA&gt;
      &lt;MentorID&gt;201586985&lt;/MentorID&gt;
      &lt;CreditHours&gt;39&lt;/CreditHours&gt;
    &lt;/Table&gt;
  &lt;/Document&gt;
  </code></pre>
  
  <p>I'm not sure how to use the count() and avg() in xquery.
  Where do I start? Any help is appreciated, Thanks.</p>