To split the data in percentage in large table and to load to subtables

Database
Not applicable

To split the data in percentage in large table and to load to subtables

Hi All,

I would need a query for below mentioned logic:

1)I have table which has huge data(In terms of Million).

2)I need to split the data into 4 parts(If I consider whole data as 100%,parts would be then 25%).

3)Data flow should be to load 1st to 25%,then 26th% to 50%,51to 75% and final load would be 76% to 100%.

Please provide the solution for this logic.

Thanks,

Chethana

2 REPLIES
Enthusiast

Re: To split the data in percentage in large table and to load to subtables

How are you defining the first 25%? Is there some criteria in play? or just the top 25% of the rows?

Junior Supporter

Re: To split the data in percentage in large table and to load to subtables

Hi,

You can use a rownum function to give row numbers to all rows based on a column sorting sequence. and then use the rowcout values to split the table in four parts.

ROW_NUMBER() OVER (ORDER BY col1 DESC ) AS new_col_name

You can also use Rank funtion to rank your rows and then split it.

--Samir