title: Select All states having smallest name in each country. Show respective country name as well
body: <p>i have two tables as below</p>
  
  <ul>
  <li><p><strong>country</strong>
  Field like(id*,code,name)</p></li>
  <li><p><strong><em>state</strong>
  Field Like(id,name,country_id</em>)</p></li>
  </ul>
  
  <p>how can i List all states having smallest name in each country. Show respective country name as well.</p>
  
  <p>here is what i am trying, where and how i use group by ?</p>
  
  <p>Query :</p>
  
  <pre><code>SELECT c.name,
         s.name,
         char_length(s.name)
  FROM state s
  JOIN country c ON s.country_id = c.id
  ORDER BY char_length(s.name)
  </code></pre>