LMSouq
general-dev Open

Error 1022 - Can't write; duplicate key in table

GI
Git-able
1 month ago
3 views
Problem Description
I'm getting a 1022 error regarding duplicate keys on create table command. Having looked at the query, I can't understand where the duplication is taking place. Can anyone else see it? SQL query: -- ----------------------------------------------------- -- Table `apptwo`.`usercircle` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `apptwo`.`usercircle` ( `idUserCircle` MEDIUMINT NOT NULL , `userId` MEDIUMINT NULL , `circleId` MEDIUMINT NULL , `authUser` BINARY NULL , `authOwner` BINARY NULL , `startDate` DATETIME NULL , `endDate` DATETIME NULL , PRIMARY KEY ( `idUserCircle` ) , INDEX `iduser_idx` ( `userId` ASC ) , INDEX `idcategory_idx` ( `circleId` ASC ) , CONSTRAINT `iduser` FOREIGN KEY ( `userId` ) REFERENCES `apptwo`.`user` ( `idUser` ) ON DELETE NO ACTION ON UPDATE NO ACTION , CONSTRAINT `idcategory` FOREIGN KEY ( `circleId` ) REFERENCES `apptwo`.`circle` ( `idCircle` ) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = INNODB; MySQL said: Documentation #1022 - Can't write; duplicate key in table 'usercircle'

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base