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/']
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*.
Interesting. All the other answers seem so complicated. I would do:

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

```

But the interviewer probably wants you to ask questions about what the ordering means, not simply come up with a solution that makes assumptions.