title: How do I order countries by name in SQL?
body: <p>I have a problem with the following task from the platform Codesignal:</p>
  <p>After some investigation, you've created a database containing a foreignCompetitors table, which has the following structure:</p>
  <p><code>competitor</code>: the name of the competitor;
  <code>country</code>: the country in which the competitor is operating.
  In your report, you need to include the <code>number of competitors per country</code> and an additional row at the bottom that contains a summary: <code>(&quot;Total:&quot;, total_number_of_competitors)</code></p>
  <p>Given the foreignCompetitors table, compose the resulting table with two columns: <code>country and competitors</code>. The first column should contain the <code>country name</code>, and the second column should contain the <code>number of competitors in this country</code>. The table should be <code>sorted by the country names</code> in ascending order. In addition, it should have an extra row at the bottom with the summary, as described above.</p>
  <p>Example</p>
  <p>For the following table foreignCompetitors</p>
  <p><a href="https://i.stack.imgur.com/5hJPD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5hJPD.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/Cb5Wj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Cb5Wj.png" alt="enter image description here" /></a></p>
  <p>my solution:</p>
  <pre><code>CREATE PROCEDURE solution()
  BEGIN
      (SELECT country, COUNT(*) AS competitors 
      FROM foreignCompetitors
      GROUP BY country
      ORDER BY country)
  
      UNION
      
      SELECT 'Total:', COUNT(*) FROM foreignCompetitors;
      
  END
  </code></pre>
  <p>But my output is:</p>
  <p><a href="https://i.stack.imgur.com/9q5vV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9q5vV.png" alt="" /></a></p>
  <p>The result of the countries is not sorted by their names.
  I cannot understand why is that even though I try to sort them with ORDER BY.</p>