title: Create columns based on unique values
body: <p>How can I create columns in a SELECT query based on unique values from another column?</p>
  
  <p>For instance I have two tables item and characteristic, an item can have multiple characteristics.</p>
  
  <p>item:</p>
  
  <pre><code>item_id | price
  i1        0.13
  i2        0.40
  i3        0.24
  ...
  </code></pre>
  
  <p>characteristic:</p>
  
  <pre><code>char_id | item_id | char_value
  c001      i1        2
  c498      i1        6
  c001      i2        4
  c265      i2        1
  c378      i3        9
  ...       ...       ...
  </code></pre>
  
  <p>What I want the output for the SQL query to be is</p>
  
  <pre><code>item_id | price | c001 | c265 | c378 | c498
  i1        0.13    2      null   null   6
  i2        0.40    4      1      null   null
  i3        0.24    null   null   9      null
  ...
  </code></pre>
  
  <p>Keep in mind there can be a lot of different char_ids so manually defining the columns to be <code>c001</code>, <code>c265</code>, <code>c378</code> and <code>c498</code> is not an option. Manually defining each column would require me to write hundreds of lines of SQL query.</p>
  
  <p>Is there a way to create an SQL query that can do this?</p>