mysql添加主键的方式

mysql添加现有字段为主键的语法如下:
 alter table dispatch add constraint PK_dispatch primary key(dispatchId);
其中dispatchId是表名,PK_dispatch代表dispatch的主键,key后面括号跟的是表中被设置为主键的字段

你可能感兴趣的:(database)