我正在尝试使用下面的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