Используйте NTILE
аналитическую функцию для расчета квартилей.
Тогда MIN
, MAX
тривиальный exersize
create table tab as
select rownum spread from dual connect by level <= 100;
with ntile as (
select
spread,
NTILE(4) OVER (ORDER BY spread DESC) qtile
from tab)
select qtile, min(spread), max(spread)
from ntile
group by qtile order by 1
;
QTILE MIN(SPREAD) MAX(SPREAD)
---------- ----------- -----------
1 76 100
2 51 75
3 26 50
4 1 25
Для вашего стола это будет что-то вроде
with spr as (
select (BOARD_RATE_T3-BOARD_RATE_T1) AS SPREAD
from pa_fcs),
ntile as (
select
spread,
NTILE(4) OVER (ORDER BY spread DESC) qtile
from spr)
select qtile, min(spread), max(spread)
from ntile
group by qtile order by 1