alter table tablename add constraint pk_tablename primary key (column1,column2,...);
可以新增单主键或联合主键;
新增主键前要检查预建主键列是否有重复数据:
select column1 from tablenamed group by column1 having count(column1)>1;