Hi I'm trying to set a foreign key to link tables within MySQL workbench and cannot work out why I'm getting the folowing error.
SQL Error 1005: Can't create table 'feedback.#sql-174_8' (errno: 150)
The SQL I'm trying to run is
ALTER TABLE `feedback`.`question_answers`
ADD CONSTRAINT `relation`
FOREIGN KEY (`relation` )
REFERENCES `feedback`.`user` (`relation` )
ON DELETE SET NULL
ON UPDATE CASCADE
, ADD INDEX `relation` (`relation` ASC) ;
The DB is called 'feedback' and I have tables called 'user' and 'question_answers' Both of the relation fields are set as (VARCHAR45) and I cannot get this link to function.