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*.
Maybe there is another way, but I think that you have to update table data:

```
update Hakuna_matata set col2=1 where col1='A';
update Hakuna_matata set col2=2 where col1='B';

```