I am new to SQL. Assume there is a table with few columns e.g.,
There are duplicates in id
column.
id | brand |
---|---|
1 | 100 |
1 | 200 |
2 | 100 |
2 | 200 |
3 | 100 |
4 | 100 |
I would like to create a new column idx
based on id and brand columns. E.g.,
id | brand | idx |
---|---|---|
1 | 100 | 101 |
1 | 200 | 201 |
2 | 100 | 102 |
2 | 200 | 202 |
3 | 100 | 103 |
4 | 100 | 104 |
So I can use idx to be my primary key in somewhere else. Any suggestions? many thanks