Ciao a tutti, vorrei aggiungere delle chiavi esterne alla tabella EVENTO con queste colonne:
Vorrei che Impianto fosse chiave esterna per una tabella Impianto e che si riferisse alla voce Nome di quest'ultima.codice:IDEvento, Nome, Sport, Impianto, IDCampo, IDCampo, Posti....
Utilizzo MySQLWorckbench e nel settare le Foreign Key con effetto ON CASCADE su Delete e Update ho questo errore:
Avreste idea da cosa possa dipendere?codice:Executing:ALTER TABLE `sharegames`.`Evento` ADD INDEX `Impianto_idx` (`Impianto` ASC); ALTER TABLE `sharegames`.`Evento` ADD CONSTRAINT `Impianto` FOREIGN KEY (`Impianto`) REFERENCES `sharegames`.`Impianto` (`Nome`) ON DELETE CASCADE ON UPDATE CASCADE; ERROR 1215: Cannot add foreign key constraint SQL Statement: ALTER TABLE `sharegames`.`Evento` ADD CONSTRAINT `Impianto` FOREIGN KEY (`Impianto`) REFERENCES `sharegames`.`Impianto` (`Nome`) ON DELETE CASCADE ON UPDATE CASCADE Operation failed: There was an error while applying the SQL script to the database.

Rispondi quotando