Home > database >  How to in oracle for 95 digits
How to in oracle for 95 digits

Time:10-06

Such as a worker information list gongrenxinxi, there is a field contains the wage gongzi, will pay in descending order, find the wage workers information in 95% of the people

CodePudding user response:

Wages in 95%
Don't understand,

CodePudding user response:

The count to calculate the total number, again by 0.95, integer, the number is 95 digits, then table order by sorting, using rownum read the records,

CodePudding user response:

refer to the second floor ZBDZJX response:
work out the total number of the count, again by 0.95, integer, the number is 95 digits, then table order by sorting, using rownum read the records,

Just in the search on the net, salary 95 quantile not calculate so, very complicated, I this is working hours before analysis, it seems different,

CodePudding user response:

reference ZBDZJX reply: 3/f
Quote: refer to the second floor ZBDZJX response:

The count to calculate the total number, again by 0.95, integer, the number is 95 digits, then table order by sorting, using rownum read the records,

Just in the search on the net, salary 95 quantile not calculate so, very complicated, I this is working hours before analysis, it seems,

I wanted to think, should be to sort data sets first, reoccupy after sorting row_num number (), and then use the count (*) * 0.5 integer, flush with the line Numbers are equal, read the record

CodePudding user response:

reference 1st floor wildwave response:
95% wage is located in the
Don't understand

A end table, contains many data, different people different path now article for a starting point, end point j path, for his travel time in ascending order and number, would like to request the position number in 95% of the total number of travel time and its 95 quantile travel time, a program is as follows,
The FUNCTION TH95_TRAVEL_TIME compiled
Errors: check the compiler error log, I am a beginner, a great god answer,
 create or replace function th95_travel_time (number, I j number) 
Return the number
As
The begin
Declare cursor cu_travel_time is
The select row_number () over rn (order by travel time), since the travel time from the end table where setting A=B and site I=j;
Row_number on the end table. Rn % type;
Travel_time on the end table. Travel time % type;
Travel_time_95th on the end table. Travel time % type;
Odjilu on the end table. Rn % type;

The begin
Select count (*) into odjilu the from on the end table where setting A=B and site I=j; - the query to the record of the number assigned to odjilu
The open cu_travel_time;
The fetch cu_travel_time into row_num travel_time;

Loop
If row_num=round (odjiuli * 0.95, 0) then
Travel_time_95th:=travel_time;
exit;
End the if;

The fetch cu_travel_time into row_num travel_time;

End loop;
The close cu_travel_time;

Return travel_time_95th;
end;
End th95_travel_time;

CodePudding user response:

 SELECT percentile_cont (0.95) within GROUP (ORDER BY salary) as p95 from table 
  • Related