title: How to calculate median in Hive
body: <p>I have a hive table,</p>
  
  <pre><code>name    age     sal
  A       45      1222
  B       50      4555
  c       44      8888
  D       78      1222
  E       12      7888
  F       23      4555
  </code></pre>
  
  <p>I want to calculate median of age column.</p>
  
  <p>Below is my approach  </p>
  
  <pre><code>select min(age) as HMIN,max(age) as HMAX,count(age) as HCount,
  IF(count(age)%2=0,'even','Odd') as PCOUNT 
  from v_act_subjects_bh;
  </code></pre>
  
  <p>Appreciate any query suggestion</p>