Script to spot distribution in number column

select
sample_size sample,
sum(ct) over() hist_size,
count(ct) over() buckets,
min_status,
max_status,
status,
ct
from (
select
sum(ct) over() sample_size,
min(status) over() min_status,
max(status) over() max_status,
status,
ct
from (
select
status,
count(*) ct
from
histogram_test_2
group by
status
)
order by
ct desc
)
where
rownum <= 3
or min_status = status
or max_status = status
order by
status
/

Reference:

Histograms Part 1 – Why?

Histograms Part 2

Histograms Part 3 – When?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s