Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Getting the 90th Percentile

2683344Jun 6 2014 — edited Jun 6 2014

Hi,

I am trying to retrieve the max, min and the 90th percentile from a table of results.

I want the 90th percentile for duration based on the timestamp_ in asc order.

My Table looks like this:

TIMESTAMP_DURATION
24/01/2000 12:04:45.120454
26/10/200  12:13:49.440301

06/01/2001 15:12:05.760

245
23/01/2001  10:56:55.680462
16/02/2001  12:10:39.360376
19/04/2001  09:22:45.12053
13/05/2001  12:36:34.560330
30/05/2001  14:47:45.600796
07/08/2001  08:51:47.520471
25/08/2001 14:24:08.640821

I have 2 queries to retrive this info, but is there a simpler solution by using one query. here are my queries:

Select MIN(DURATION), max(DURATION)

from t

;

select DURATION as nine from t

where TIMESTAMP_ =

(

select

Percentile_disc(0.90) within group (order by TIMESTAMP_) AS nth

from t

)

THANKS

This post has been answered by 2683344 on Jun 6 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 4 2014
Added on Jun 6 2014
1 comment
1,388 views