Failed to add the foreign key in MySQL

Answered

I tried to create a foreign key in the table Customer , but got this error? What have i done wrong?

0
2 comments

See the same issue described on StackOverflow: 

https://stackoverflow.com/questions/43511183/mysql-error-1822-failed-to-add-foreign-key-constraint-missing-index-for-contra

the column CUSTOMER_CODE in CONTRACT table is neither unique nor primary that's why it is showing error.

0

Thank you for help!!!

0

Please sign in to leave a comment.