Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 2
    This actually works pretty well, and allows for partitioning of the data. Commented Oct 6, 2010 at 0:26
  • 4
    If it's OK to be off by one, then the query above is fine. But if you need the exact median, then you will have trouble. For example, for the sequence (1,3,5,7) the median is 4 but the query above returns 3. For (1,2,3,503,603,703) the median is 258 but the query above returns 503. Commented Oct 30, 2012 at 6:12
  • 1
    You could fix the flaw of imprecision by taking max and min of each quartile in a subquery, then AVGing the MAX of the previous and MIN of the next? Commented Jul 23, 2013 at 14:31