MySql 创建多字段主键
1.如果已有主键要先清除现有主键
ALTER TABLE yourtable
DROP PRIMARY KEY;
PS:如果你的主键是自增的,要先去除自增特性 才能去除主键
2. 创建复合主键
ALTER TABLE yourtable
ADD PRIMARY KEY (employeeid, recordmonth, recordyear);
1.如果已有主键要先清除现有主键
ALTER TABLE yourtable
DROP PRIMARY KEY;
PS:如果你的主键是自增的,要先去除自增特性 才能去除主键
2. 创建复合主键
ALTER TABLE yourtable
ADD PRIMARY KEY (employeeid, recordmonth, recordyear);