I have a table (T1) with some fields F2, F3 (Columns) with already some values in it .... .
I need to add a new field (F1) to the table (T1) and F1 will be the primary k
If you are using MySQL:
ALTER TABLE myTable
AUTO_INCREMENT = 1677216 ,
ADD COLUMN F1 INT PRIMARY KEY AUTO_INCREMENT ;
Existing rows will have the F1
field automatically filled with ids, starting from 1677216
.
If you are worried that it is an integer and not a string, pretend it's a string by never using id
, only use RIGHT(id,8)