Salve a tutti.
Sto utilizzando il mysql workbench.
Uno strumento molto pratico e semplice se non per il fatto che la creazione delle chiavi esterne mi sta dando parecchie noie.
In particolare, provando a creare una chiave esterna ottengo i seguenti errori:
ERROR 1215: Cannot add foreign key constraint
SQL Statement:
ALTER TABLE `lastest`.`operazione`
ADD CONSTRAINT `nomePorta`
FOREIGN KEY (`nomePortata` )
REFERENCES `lastest`.`portata` (`nomePortata` )
ON DELETE NO ACTION
ON UPDATE NO ACTION
, ADD INDEX `nomePorta_idx` (`nomePortata` ASC)
ERROR: Error when running failback script. Details follow.
ERROR 1046: No database selected
SQL Statement:
CREATE TABLE `operazione` (
`idOp` int(11) NOT NULL AUTO_INCREMENT,
`nomePortata` varchar(45) NOT NULL,
`nomeOp` varchar(45) DEFAULT NULL,
`numeroInteressati` int(11) DEFAULT NULL,
PRIMARY KEY (`idOp`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
La tabella Portata alla quale la fk farebbe riferimento esiste e il campo e' varchar tutto corretto
![]()

Rispondi quotando
