title: Using Case statement in select
body: <p>I have a table </p>
  
  <pre><code>id     salary
  
  1            100
  
  2            200
  
  3            300
  
  4            400
  </code></pre>
  
  <p>Now I wanted to find the average salary and then compare with each individual salary and then say as <em>'High'</em> or <em>'Low'</em>.</p>
  
  <p>Whether this can be done with case statement or please suggest me some good way?</p>
  
  <p>My query is </p>
  
  <pre><code>select xxxxxxxxxx = 
  case 
  when(salary&gt;(select avg(salary)from table_name))
  then 'High'
  when(salary&lt;(select avg(salary)from table_name))
  then 'low' 
  end;
  </code></pre>
  
  <p>But here my problem is i dont have that xxxxxxxxx column in my table.</p>
  
  <p>is there anyway i can get the value <em>-'High'</em> or <em>'Low'</em> without adding/Specifying a column in that table to store values?</p>
  
  <p>So please suggest me a solution with using case statement.</p>