title: How to use a column alias immediately after it's been named in a SELECT clause?
body: <p>I created a column alias in line 7 called total_city_pop.</p>
  
  <p>Then, in line 8, I tried to use that alias in a new calculation.</p>
  
  <p>But, I received an error message that says "column "total_city_pop" does not exist LINE 8: (ci.city_proper_pop + ci.metroarea_pop) / total_city_pop AS ... ^"</p>
  
  <p>Why can't I use the alias name after I created it?</p>
  
  <p>Here's the code -- </p>
  
  <pre><code>SELECT co.code, ci.name AS capital_city, ci.city_proper_pop, ci.metroarea_pop, ci.urbanarea_pop,
      CASE
          WHEN (ci.city_proper_pop + ci.metroarea_pop + ci.urbanarea_pop) IS NULL
          THEN (ci.city_proper_pop + ci.urbanarea_pop)
          ELSE (ci.city_proper_pop + ci.metroarea_pop + ci.urbanarea_pop) END AS total_city_pop, 
      (ci.city_proper_pop + ci.metroarea_pop) / total_city_pop AS percent_outside_urbanarea 
  FROM countries AS co 
      INNER JOIN cities AS ci ON co.capital = ci.name 
      WHERE continent LIKE '%America%' OR continent LIKE 'Europe'     
      ORDER BY total_city_pop DESC 
      LIMIT 10;
  </code></pre>
  
  <p>Thank you.</p>