title: Top n percent top n%
body: <p>I do have the following code.</p>
  
  <pre><code>    SQL&gt; select * from student_gpa;
  
      SSN                    GPA
      --------------- ----------
     22222                    3
     11111                    4
     55555                    3
     33333                    4
     44444                    3
  </code></pre>
  
  <p>I do have this function to get the top two gpa score rows.</p>
  
  <p>SQL> select * from (select ssn, gpa from student_gpa order by gpa desc) where  rownum &lt;= 2;</p>
  
  <pre><code>     SSN                    GPA
      --------------- ----------
      11111                    4
      33333                    4
  </code></pre>
  
  <p>My question is what function do I use to get the top n% of the GPA score.  For example, Since I have two individuals with a GPA of 4, dense rank would return 11111 occupying row 1 and 22222 occupying row 2. I was actually looking for a function say that calculates 5% of the GPA score and the returned value would be both 11111 and 22222. The 5% function SHOULD NOT return 11111 only. Even if I had more entries that had gpa of 4, the 5% function would still return all rows that had gpa of 4.Thanks </p>