0

I keep getting a duplicate key error for trying to reference a primary key from another table, The script is shown below. I am trying to reference a primary key from a table called Session_and_fees_information. The table I am trying to reference from also has its own primary key. The main idea behind trying to include the foreign key is to establish a relationship between the table Arcade Machine Information and the table Session and fees information. The scripts along with the errors can be found below. I have used 4 different versions of workbench but the same error keeps coming up. The latest version, on the day I am writing this post, has also shown me the same problem.

ERROR 1022: Can't write; duplicate key in table 'arcade_machine_information'
SQL Statement:
CREATE  TABLE `retro club`.`Arcade_machine_information` (
  `Machine_number` INT NOT NULL ,
  `Floor` INT NULL ,
  `Info_ID` VARCHAR(5) NULL ,
  `Game` VARCHAR(15) NULL ,
  `Year` YEAR NULL ,
  PRIMARY KEY (`Machine_number`) ,
  INDEX `Info_ID` (`Info_ID` ASC) ,
  CONSTRAINT `Info_ID`
    FOREIGN KEY (`Info_ID` )
    REFERENCES `retro club`.`session_and_fees_info` (`Info_ID` )
    ON DELETE NO ACTION
    ON UPDATE CASCADE)

Is there a method for me to get rid of this error? If there is, please help.

0 Answers0