title: How to parse a SQL result and convert it to Ruby hash
body: <p>I want to convert a SQL query result into a Ruby hash, where only two rows are shown and the first act as key and second as value. For example, if my query got this result:</p>
  
  <p><code>
  +----+--------+
  | id |  name  |
  +--- +--------+
  | 1  |    a   |
  | 2  |    b   |
  | 3  |    c   |
  | 4  |    d   |
  | 5  |    e   |
  +----+--------+
  </code></p>
  
  <p>I want to manipulate this data to get a Ruby hash like this:</p>
  
  <pre><code>h = { '1' =&gt; 'a',
        '2' =&gt; 'b'.
        '3' =&gt; 'c',
        '4' =&gt; 'd',
        '5' =&gt; 'e' }
  </code></pre>
  
  <p>How can I get this done?</p>