title: PostgreSQL: using a calculated column in the same query
body: <p>I am having trouble using a calculated column in postgres. A similar code which works in SQL is given below, is it possible to recreate this in <code>PostgreSQL</code>?</p>
  
  <pre><code>select cost_1, quantity_1, cost_2, quantity_2, 
        (cost_1 * quantity_1) as total_1,
        (cost_2 * quantity_2) as total_2,
        (calculated total_1 + calculated total_2) as total_3
  from data;
  </code></pre>
  
  <p>In <code>PostgreSQL</code> a similar code returns the error that:</p>
  
  <blockquote>
    <p>the column total_1 and total_2 do not exist.</p>
  </blockquote>