Recipes‎ > ‎Programming‎ > ‎

MySQL

Adding the AUTO_INCREMENT attribute to an existing primary key


The column attributes were copied verbatim from SHOW CREATE TABLE output.

alter table logEntry change logOid logOid bigint(20) unsigned not null auto_increment;

Finding duplicate rows

select address, count(address) as cnt
from mailing_list
group by address
having cnt > 1
order by cnt;


Comments