This was the question asked to me in interview :

Input:

```
SQL> select col1,col2 from Hakuna_matata;

COL1                      ~             COL2
--------------------------------------------------~
A                         ~             2
B                         ~             1
C                         ~             3

```

I want output as 

```
COL1                      ~             COL2
--------------------------------------------------~---
A                         ~             1
B                         ~             2
C                         ~             3

```

How you will do in SQL?

Please help me with the queries/way how this can be done .
['https://Stackoverflow.com/questions/49217832', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9474466/']
You can order by ascending both column in separate and then merge it using [with clauses](https://oracle-base.com/articles/misc/with-clause), `rownum` **EDIT** using @Kaushik Nayak Tip in comments

```
with a as 
(select rownum as r,a1.* from (select col1, col3 from Hakuna_matata order by col1 asc ) a1)
, b as 
(select rownum as r,a2.* from (select col2  from Hakuna_matata order by col2 asc ) a2)
select a.col1, b.col2, a.col3 from a ,b where a.r=b.r;

```

col3 is example of adding more columns to select
As there is no explanation given on how `col2` should be generated (e.g. swapping the values or just re-numbering them), I'd go for:

```
select col1,   
       row_number() over (order by col1) as col2 
from Hakuna_matata;

```

Which produces the desired output - but it's unclear if that is the desired *solution*.