2013-05-08 46 views
1

我有一個設置爲唯一的外鍵,我需要它設置爲mul。這個命令是什麼?命令將外鍵從uni更改爲mul

+0

你的意思是多列或MUL什麼? – 2013-05-08 02:17:53

+0

需要,使之成爲非唯一索引 – Jessica 2013-05-08 02:27:18

+0

CREATE TABLE IF NOT EXISTS'instructorstudentgroup'( 'InstructorStudentGroupID' INT(2)NOT NULL AUTO_INCREMENT, 'Instructor' VARCHAR(60)DEFAULT NULL, 'ClinicalID' INT(2 )DEFAULT NULL, 'Location' VARCHAR(30)DEFAULT NULL, PRIMARY KEY('InstructorStudentGroupID') UNIQUE KEY'ClinicalID'('ClinicalID') )ENGINE = InnoDB的默認字符集= LATIN1 AUTO_INCREMENT = 1; – Jessica 2013-05-08 02:28:24

回答

0

我假設你想改變你的唯一密鑰

CREATE TABLE IF NOT EXISTS instructorstudentgroup 
(InstructorStudentGroupID int(2) NOT NULL AUTO_INCREMENT, 
Instructor varchar(60) DEFAULT NULL, 
ClinicalID int(2) DEFAULT NULL, 
Location varchar(30) DEFAULT NULL, 
PRIMARY KEY (InstructorStudentGroupID), 
UNIQUE KEY ClinicalID (ClinicalID)) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; 

這是放棄你ClinicalID

alter table instructorstudentgroup drop index ClinicalID;