I have a table with two columns n integer and s varchar. n is the primary key. s is mostly unique but not always. For example
n s
1 New York
2 Moscow
3 Paris
4 London
5 Moscow
6 Berlin
7 Moscow
I want to create another table with the same structure, the same number of rows except that s will be made unique by adding numeric suffix to second and further occurences. Example:
n s
1 New York
2 Moscow
3 Paris
4 London
5 Moscow 2
6 Berlin
7 Moscow 3
In a single SQL command in a platform independent way (sqlite is my database). Any ideas?