I'm curious how to create table2
of the same structure with the same data as table1
, but with order by the column frequency.
Or, the equivalent of this problem is: to change the id of rows in the table properly.
It doesn't matter, whether by ASC, or DESC.
As result, the table1
:
**id - name - frequency**
1 - John - 33
2 - Paul - 127
3 - Andy - 74
Should become table2
:
**id - name - frequency**
1 - Paul - 127
2 - Andy - 74
3 - John - 33
What's the shortest way to do that?
Also, I would be interesting in the query that's fastest for huge tables (although performance is not so important for me).