Median with standard SQL
From: Jess Likens <likens_at_students.uiuc.edu>
Date: Mon, 9 Jul 2001 13:13:07 -0500
Message-ID: <yqm27.364$oz3.4759_at_vixen.cso.uiuc.edu>
Date: Mon, 9 Jul 2001 13:13:07 -0500
Message-ID: <yqm27.364$oz3.4759_at_vixen.cso.uiuc.edu>
Does anyone have a method to get the median of a relation using only the
following SQL commands: SELECT, DISTINCT, WHERE, FROM, LIKE, EXISTS, IN,
UNION, INTERSECT, EXCEPT/MINUS, ANY, ALL, COUNT, SUM, AVG, MAX, MIN, GROUP
BY, HAVING, ORDER BY, JOIN? I can't seem to come up with anything. The
median of n elements occurs at (n+1)/2 for an odd number of elements and it
is the average of n/2 and n/2 and (n+1)/2. Any help would be much
appreciated.
-Jess
Received on Mon Jul 09 2001 - 20:13:07 CEST