Re: Calculating the median

From: <sw_at_weinerfamily.org>
Date: Mon, 04 Dec 2000 14:55:53 GMT
Message-ID: <3A2BB04A.53C2F6C5_at_weinerfamily.org>


This is the average. The median is the value in the middle of your numbers.

Given:
VAL



2
3
4
17
27

The median is 4. NOTE If there are even number of values you probably want to average the two middle values. In no case do you want to average all value.

Miguel Cruz wrote:

> In article <3A27E3AF.FFA9DB5F_at_weinerfamily.org>, <sw_at_weinerfamily.org> wrote:
> > Given a column of numbers, how do I calculate the median? I don't see a
> > function to do it. Do I need to write a procedure?
>
> select a/b from
> (select sum(the_column) as a, count(the_column) as b
> from the_table where the_column is not null);
>
> miguel
Received on Mon Dec 04 2000 - 15:55:53 CET

Original text of this message