Monday, June 6, 2016

Sort records in acceding order without using order by

Hint: Union will automatically sort records in ascending order

create table t27 as
select rownum rn from dual connect by rownum<100;


select * from t27;

delete from t27 where rn<10;


insert into t27
select rownum rn from dual connect by rownum<10;


select * from t27;

with q1 as (select rn from t27  union select rn from t27)
select t1.rn from t27 t1, q1 where T1.RN=q1.rn;

No comments:

Post a Comment