/* ORACLE - obtain the median row within a select query */ /* If the number of rows is odd, you get that value */ /* If the number of rows is even, you get the average of the 2 rows */ select median(student_id) from student; /* odd */ select * from student where student_id = (select median(student_id) from student); select median(amount) from payment; /* even */ select * from payment where amount >= (select median(amount) from payment);