I am trying to add foreign keys to my table but getting this error. Error code: 1005 Unable to create table 'william. # Sql-88c_3 '(errno: 150) I have 3 tables. employee, client and contract.
use [employee_no PK], client [customer_no PK] contract [contract_no PK] I want to have foreign keys for the contract as a contract [contract_no PK, employee_no FK], customer_no FK]
I tried to do this directly, but now I'm trying to change the expression. Is there something wrong with the Alter script?
ALTER TABLE contract
ADD CONSTRAINT `employee_no_fk2` FOREIGN KEY (`employee_no`) REFERENCES `employee`
(`employee_no`);
ALTER TABLE contract
ADD CONSTRAINT `Customer_no_fk2` FOREIGN KEY (`Customer_no`) REFERENCES `client`
(`Customer_no`);
source
share