Mysql: Using Two Foreign Keys To The Same Table
I'm using MySQL workbench to design a database. Server is mysql 5.5.6 I've defined a few foreign keys linking the 'candidates' table to the 'countries' table. I get this error: Exe
Solution 1:
Your schema generator doesn't work correctly.
It should generate:
CONSTRAINT `fk_candidats_pays`
FOREIGN KEY (`pays`)
REFERENCES `customer`.`pays` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_candidats_Nationalite`
FOREIGN KEY (`Nationalite`)
REFERENCES `customer`.`pays` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
To your other question: This type of referencing seems strange when you see it the first time, but it's quite normal and I think there is no other way of constructing this type of relationship.
Post a Comment for "Mysql: Using Two Foreign Keys To The Same Table"