mysql> select * from animals; id name foot 1 dog 4 2 cat 4 3 chicken 2 4 cat 4 mysql>
mysql> create table tmp -> select id,name,foot -> from animals -> group by name,foot; mysql>
mysql> drop table animals; mysql>
mysql> alter table tmp rename to animals; mysql>
mysql> select * from animals; id name foot 2 cat 4 3 chicken 2 1 dog 4 mysql>
mysql> alter table animals add primary key(id); Query OK, 0 rows affected (0.15 sec) Records: 0 Duplicates: 0 Warnings: 0
mysql> alter table animals modify id int unsigned not null auto_increment; Query OK, 4 rows affected (0.16 sec) Records: 4 Duplicates: 0 Warnings: 0
mysql> ALTER TABLE animals AUTO_INCREMENT = 150; Query OK, 4 rows affected (0.37 sec) Records: 4 Duplicates: 0 Warnings: 0