title: To calculate department wise percentage of employees
body: <p>table DEPT looks like this.</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>dname</th>
  <th>NO_of_emp</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>Hr</td>
  <td>10</td>
  </tr>
  <tr>
  <td>Finance</td>
  <td>30</td>
  </tr>
  <tr>
  <td>Analyst</td>
  <td>50</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Need output like below.</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>dname</th>
  <th>NO_of_emp</th>
  <th>per_of_emp_dept_wise</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>Hr</td>
  <td>10</td>
  <td>11.11</td>
  </tr>
  <tr>
  <td>Finance</td>
  <td>30</td>
  <td>33.33</td>
  </tr>
  <tr>
  <td>Analyst</td>
  <td>50</td>
  <td>55.55</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>to get 'per_of_emp_dept_wise' column  logic is : ((NO_of_emp /total NO_of_emp) *100)</p>
  <p>How to achieve this.</p>
  <p>tried using rollup:</p>
  <pre><code>SELECT
      dname,
      SUM(no_of_emp),
      ( ( no_of_emp ) / SUM(no_of_emp) * 100 )
  FROM
      dept
  GROUP BY
      ROLLUP(deptno);--&gt; gives error  ORA-00979: not a GROUP BY expression.
  </code></pre>
  <p>but not able to include rollup data into SELECT section to calculate new('per_of_emp_dept_wise') column.</p>
  <p>Can any one suggest solution to this.</p>
  <p>Thanks in advance.</p>
  <p>Rajini</p>