Assume a table that uses a natural key and has a number of existing rows. What would be the easiest way to retrofit a surrogate key column and populate it with unique values using MySql?
I.e. transform
table employees
(
social_security_no varchar(20),
...
constraint emp_pk primary key (social_security_no)
);
to
table employees
(
id int,
social_security_no varchar(20),
...
constraint emp_pk primary key (id)
);
and fill the new id column with valid id:s.
Thanks /Erik