0
我想在MySQL數據庫中創建表的SQL以下不能在MySQL數據庫中創建表
CREATE TABLE IF NOT EXISTS `dev_dict`.`TAMILWORD_SECONDARY` (
`ID` INT NOT NULL ,
`TAMILWORD_ID` INT NOT NULL ,
`WORDS` VARCHAR(50) NOT NULL ,
`CREATED_DTTM` TIMESTAMP NOT NULL ,
`MODIFIED_DTTM` TIMESTAMP NOT NULL ,
PRIMARY KEY (`ID`) ,
UNIQUE INDEX `WORDS_UNIQUE` (`WORDS` ASC, `TAMILWORD_ID` ASC) ,
INDEX `FK_TAMILWORD_ID_idx` (`TAMILWORD_ID` ASC) ,
CONSTRAINT `FK_TAMILWORD_ID`
FOREIGN KEY (`TAMILWORD_ID`)
REFERENCES `dev_dict`.`TAMILWORD` (`ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
,但得到錯誤代碼:1022。無法寫入;表'tamilword_secondary'中的重複鍵。
感謝幫助我..我有表tamilword已經,並獲得同樣的錯誤
CREATE TABLE IF NOT EXISTS `dev_dict`.`TAMILWORD` (
`ID` INT NOT NULL ,
`WORD` VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NOT NULL ,
`SENTENCE` VARCHAR(100) NULL ,
`CREATED_DTTM` TIMESTAMP NOT NULL ,
`MODIFIED_DTTM` TIMESTAMP NOT NULL ,
PRIMARY KEY (`ID`) ,
INDEX `SECONDARY` (`WORD` ASC, `SENTENCE` ASC))
ENGINE = InnoDB
我可以創建表,如果我改變發動機的MyISAM。我不知道數據庫引擎..和其他表引擎InnoDB。請讓我知道這是正確的方式? – 2013-03-13 19:20:40