title: How to get values that are >= 25%, 50%, 75% of a list from a column using SQL
body: <p>My table has a single column called <code>Speed</code> (integer), and I need to select values that are greater than 25%, 50%,... values in that list.</p>
  
  <p>Sample data:</p>
  
  <pre><code>+-------+
  | Speed |
  +-------+
  |     1 |
  |     2 |
  |     3 |
  |     4 |
  |     5 |
  |     6 |
  |     7 |
  |     8 |
  |     9 |
  |    10 |
  +-------+
  </code></pre>
  
  <p>Desired output:</p>
  
  <pre><code>+--------+
  | OUTPUT |
  +--------+
  |      3 |
  |      5 |
  |      8 |
  +--------+
  </code></pre>
  
  <p>Explain:</p>
  
  <ul>
  <li>3 >= 25% numbers in the list</li>
  <li>5 >= 50% numbers in the list</li>
  <li>8 >= 75% numbers in the list</li>
  </ul>
  
  <p>I think that I should sort the data, and do something like:</p>
  
  <pre><code>SELECT speed 
  FROM my_table
  WHERE speed IN (ROUND(0.25 * &lt;total_row&gt;), ROUND(0.50 * &lt;total_row&gt;),..) 
  </code></pre>
  
  <p>but I don't know how to get that <code>&lt;total_row&gt;</code> reference. If I could just <code>SELECT COUNT(speed) AS total_row</code>, and use that later, that would be great.</p>
  
  <p>Thank you so much. </p>